Import Ahrefs Data to Google Sheets
In this guide, I’ll get you started on pulling data from the awesome Ahrefs SEO tool suite into Google Sheets, using the API Connector add-on for Sheets. Targeted around backlinks, you can use the Site Explorer, Content Explorer, Keywords Explorer, Rank Tracker, and Site Audit to compare your website to competitors. All in all, it’s a pretty sweet tool and we can integrate its native API with Google Sheets!
- Before You Begin
- Part 1: Connect to the Ahrefs API
- Part 2: Create your Ahrefs API Request URL
- Part 3: Pull Ahrefs API Data into Sheets
- Part 4: More Example API URLs
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: CONNECT TO THE AHREFS API
If you haven’t connected to the Ahrefs API before, you’ll first need to initiate the connection.
- Open up Google Sheets and click Add-ons > API Connector > Manage Connections.
- In the list of available connections, find Ahrefs and click Connect.
- You will see a modal asking you to approve the connection. Click Allow.
- You’ll then be returned to your Google Sheet, and can verify that your Ahrefs connection is active in the Connections screen.
PART 2: CREATE YOUR AHREFS API REQUEST URL
Ahrefs is nice enough to avoid a lot of the headache of piecing together an API request URL by providing us with this API request builder tool. You can access it by clicking “API Request Builder” in the left sidebar.
From here, it’s super easy! Under Target, enter the website you’re interested in, then choose which data you want to get in the Mode and From drop-downs. Set your Limit and any Options, and copy the API URL Request that gets printed out below. Just remove the API token since we’ll include that automatically through the OAuth connection.
PART 3: PULL AHREFS API DATA INTO SHEETS
We can now enter these values into API Connector and import Ahrefs data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create Request tab, enter the Request URL we just created
- Under OAuth2 Authentication, choose Ahrefs from the dropdown menu.
- Leave the Headers section empty as we don’t need them for this request
- Create a new tab and click “Set current” to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see some Ahrefs data populate your spreadsheet:
PART 4: MORE EXAMPLE API URLS
As previously mentioned in the last part, Ahrefs provides a handy API tool for creating ready-to-paste API requests. Let’s check out the documentation and see what kind of data we can get from our website. A few other example endpoints that may be useful for you would be:
- Top 10 backlinks:
- Top 10 referring domains ordered by Domain Rating:
- New backlinks on 2021-08-20