Instagram’s API has a lot of features, including the ability to track hashtags and analyze performance data, collect data about mentions, embed Instagram photos on a website, and more.
In this tutorial, I’ll show you how to connect the Instagram API to Google Sheets and import Instagram data to Google Sheets, without writing any code, in 9 easy steps:
To pull data from the Instagram API to Google Sheets easily and without writing any code, first install and open the Apipheny Google Sheets add-on.
Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs (including the Instagram API), save API requests, schedule API requests, and more. Click here if you want to learn more about Apipheny.
1. Install Apipheny by clicking the Install button on this page.
2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons option in the top menu. In the add-ons menu, you should see Apipheny.
Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets, then you’ll be ready to import your first API!
Start by navigating to https://developers.facebook.com/ and click My Apps > Create App:
Fill out your app’s display name and contact email and click Create App ID:
You’ll then be directed back to your Facebook Developer dashboard.
3.) Copy and paste your App ID from under the app’s name to a safe location, because you will need the APP ID again in the later steps:
2. Click the Setup button corresponding to the Facebook Login card:
3. Choose the platform you want to use. In this case we chose Web:
4. Enter your redirect URI in the Valid OAuth redirect URIs field (you can use https://www.apipheny.io/ if you want), and then click the Save Changes button:
In your browser’s address bar, paste the following URL, but replace the fields in curly braces, then press Enter:
https://www.facebook.com/v7.0/dialog/oauth?client_id={app_id}&redirect_uri={redirect_URI} &state={random_string}&response_type=token&scope=instagram_basic,pages_show_list,instagram_manage_insights
Facebook will ask you to confirm your account and to associate it with your app. Select your account, then click the Next button:
Next, select the page you want to use with your app, then click the Next button:
On the following step, confirm the app’s access rights and click the Done button:
Finally, click the OK button to confirm linking your Instagram app:
Your browser will be redirected and your access token will be displayed in the address bar.
Copy and paste your Facebook access token to a safe location, because you’ll need it again in the next steps:
In your browser’s address bar, paste the following link, replace your access token, then press Enter:
https://graph.facebook.com/me/accounts?access_token={access_token}
{access_token} is the access token you obtained previously at the end of Step 4. Just replace it with your token.
In the response you receive, you’ll get your Page ID. Copy and paste your Page ID to a safe location because you will need it again in the next steps.
In your browser’s address bar, paste the following link, replace the Page ID and the access token, then press Enter:
https://graph.facebook.com/{page_id}?fields=instagram_business_account&access_token={access_token}
From the received response, you’ll get your Instagram Account ID. Copy and paste your Instagram Account ID to a safe location because you will need it in the next steps:
In this section, we’ll show you how to browse the Instagram API documentation to find an API endpoint URL that retrieves the information you need from Instagram.
If you’re unsure what an API is, or how it works, let me explain briefly. Every API has a URL. Every API URL has endpoint(s) that you can use to specify what exact data you want returned from the API.
If you already know the Instagram API URL and endpoint that you want to use, or you want to use the same example URL and endpoint as us, just skip to Step 8.
To find your endpoint, first open the Instagram API documentation page: https://developers.facebook.com/docs/instagram
You’ll see that the menu on the left contains a list of available Instagram APIs:
For example, click on the Instagram Graph API, then click the Reference item. There you’ll find a list with all the available endpoint categories:
The Page category contains multiple endpoints:
One of the Page category endpoints is Getting a Page’s IG User, which returns the Instagram User connected to the Facebook Page:
https://graph.facebook.com/{page-id}?fields=instagram_business_account
{page-id} is the ID of the connected Facebook Page.
The documentation for this endpoint contains the endpoint’s HTTP method (GET) and API URL, a short description of the endpoint’s purpose, a list of the required permissions, an example request and its accompanying response:
Now, to get your Instagram data in your Google Sheet, go back to your Google Sheet and make sure that you’ve installed the Apipheny add-on and you have it opened to the “Import” tab.
In the Import Tab, enter the following details into the Apipheny add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your Instagram API endpoint. For this example, we are using the “GET” method.
API URL: In Step 7, we explained how you can find the Instagram API endpoint that you need. Now copy your complete Instagram API URL into the Apipheny add-on, in the field that says API URL Path (JSON / CSV), followed by any GET parameters required for your query (if applicable).
For this example, we are using the Business Discovery endpoint, which allows you to get basic metadata and metrics about other Instagram Business and Creator Accounts. The corresponding API URL is:
https://graph.facebook.com/{account_id}?fields=business_discovery.username({username}){followers_count,media_count}&access_token={your_access_token}
Headers: No headers are required for this Instagram API request.
The last step is to click the Run button at the bottom of the Apipheny add-on and then your Instagram data will be imported into your Google Sheets, congratulations!
After making a successful request to the Instagram API in your Google Sheet, try querying a different Instagram API endpoint, or try using one of the more advanced features in the Apipheny add-on, such as:
If you want to import Instagram data into Google Data Studio, follow the steps above to integrate the Instagram API with Google Sheets, then connect your Google Sheet to Google Data Studio.