How to get Instagram follower counts in Google Sheets
Checked on 2026-11-24.
Put the usernames in column A, type =IG_FOLLOWERS(A2) in B2, and a custom function fills the column with each account's exact follower count. Google Sheets has no built-in function that does this. Two routes work from Apps Script: Meta's official API for business and creator accounts, and an HTTP API for any public account.
Why not IMPORTXML?
IMPORTXML is the built-in function for reading web pages: Google's help page says it "Imports data from any of various structured data types including XML, HTML, CSV, TSV, and RSS and ATOM XML feeds", given an address and an XPath query. What Instagram sends back to it is documented neither by Google nor by Instagram, so this guide shows no formula for it.
1. Meta's official API: business and creator accounts
Meta's Business Discovery "Allows you to get data about other Instagram Business or Creator IG Users", in the words of its reference. You ask through your own professional account, so you need one, plus a Meta app and an access token with the permissions instagram_basic, instagram_manage_insights and pages_read_engagement; the guide on follower counts in Python walks through that setup. With the token, the call fits in a custom function. Store your account's ID and the token as script properties named IG_ACCOUNT_ID and IG_ACCESS_TOKEN, the way the key is stored further down:
/**
* Followers of an Instagram business or creator account, from Meta's Business Discovery.
* @customfunction
*/
function IG_FOLLOWERS_META(username) {
if (!username) return "";
const props = PropertiesService.getScriptProperties();
const fields = "business_discovery.username(" + username + "){followers_count,media_count}";
const url = "https://graph.facebook.com/v27.0/" + props.getProperty("IG_ACCOUNT_ID")
+ "?fields=" + encodeURIComponent(fields)
+ "&access_token=" + encodeURIComponent(props.getProperty("IG_ACCESS_TOKEN"));
const body = JSON.parse(UrlFetchApp.fetch(url, { muteHttpExceptions: true }).getContentText());
if (body.error) throw new Error(body.error.message);
return body.business_discovery.followers_count;
}The request is the one in Meta's example, which reads the account bluebottle with version v27.0 of the Graph API. For your own account, the IG User reference has the field followers_count.
Where it stops: at personal accounts, which Business Discovery does not cover, and "Data about age-gated Instagram Business IG Users will not be returned." The token is the other catch: Meta's overview says a long-lived token "is valid for 60 days and can be refreshed before they expire", and once it lapses the function fails until you store a new one.
2. Any public account: paste a custom function
This route reads the public profile through Pipefetch, so it needs no Instagram account and no Meta app, and the account can be personal, business or creator. In your sheet open Extensions, then Apps Script, delete what is in the editor, paste this and click Save.
const API = "https://pipefetch.com";
// One request to the API. A 404 means nothing was found, which costs nothing.
function pipefetch_(path, params) {
const key = PropertiesService.getScriptProperties().getProperty("PIPEFETCH_API_KEY");
if (!key) throw new Error("Add PIPEFETCH_API_KEY under Project Settings, Script properties.");
const query = Object.keys(params).map((name) => name + "=" + encodeURIComponent(params[name])).join("&");
const res = UrlFetchApp.fetch(API + path + "?" + query, {
headers: { "x-api-key": key },
muteHttpExceptions: true,
});
if (res.getResponseCode() === 404) return null;
const body = JSON.parse(res.getContentText());
if (res.getResponseCode() !== 200) throw new Error(body.error.message);
return body.data;
}
/**
* The exact follower count of a public Instagram account.
* @customfunction
*/
function IG_FOLLOWERS(username) {
if (!username) return "";
const data = pipefetch_("/v1/instagram/profile", { username: username, posts: "false" });
if (!data) return "No such account";
return data.followerCount;
}
/**
* Name, followers, following, posts, verified and account type, across six cells.
* @customfunction
*/
function IG_PROFILE(username) {
if (!username) return "";
const data = pipefetch_("/v1/instagram/profile", { username: username, posts: "false" });
if (!data) return "No such account";
return [[data.fullName || "", data.followerCount, data.followingCount, data.postCount, data.isVerified, data.accountType || ""]];
}Store your API key
Keep the key out of the script and out of the cells. In the Apps Script editor click Project Settings, and under Script Properties click Add script property: the name is PIPEFETCH_API_KEY, the value your key. You get a key, with 100 free credits and no card, in the dashboard. Editors of the sheet "can view, edit, and run its bound script", in the words of Google's page on bound scripts, so they can read the key too; share results with anyone else as values in a sheet without the script.
Use it in the sheet
=IG_FOLLOWERS(A2) the follower count
=IG_PROFILE(A2) name, followers, following, posts, verified, account typeColumn A can hold usernames, handles with @ or profile links. Drag the formula down: each cell is one request and shows Loading... for a few seconds. IG_PROFILE fills six cells across; the five to the right of the formula have to be empty, or the function "throws an error instead".
The counts are exact, not the rounded ones Instagram displays: nasa, read on 18 November 2026, had 104,328,951 followers where its profile shows 104M. A private account still returns its counts. An account that does not exist shows "No such account" and costs nothing; every profile found costs 2 credits. The reference lists more fields you can add to IG_PROFILE, such as the bio and the engagement rate.
Where it stops: it returns what a profile shows to a visitor who is not logged in, so no follower lists and no posts of private accounts. When Instagram does not answer, the cell shows an error, the request costs nothing, and re-entering the formula tries again. It is not an official API, and Pipefetch is not affiliated with Instagram or Meta.
The limits that bite
- 30 seconds per cell. Google's custom functions guide: "A custom function call must return within 30 seconds." Otherwise the cell shows
#ERROR!with the noteExceeded maximum execution time (line 0). Most requests take 2 to 9 seconds. A request the cell gave up on can still finish on our side, and if it returns data it is charged although the cell never shows it; one that returns nothing costs nothing. - Recalculation is a new request. A custom function runs again when you edit its formula or change a cell it points to, and each run that returns data is charged. To be sure a filled column is never fetched again, paste it over itself with Paste special, Values only. Passing
NOW()orRAND()to make it refresh does not work: volatile arguments are not allowed, and the cell showsLoading...indefinitely. - Google's daily quota. The quotas page allows 20,000 URL Fetch calls a day for a personal Google account and 100,000 for Google Workspace, reset 24 hours after the first request. Custom functions run as an anonymous user, but the calls count against whoever is at the keyboard.
- Pipefetch's limits. 120 requests a minute per account; above that the cell shows "Too many requests. Slow down and retry in a moment." Requests that find nothing are free, up to 100 a day plus one for every request that returned data, reset at 00:00 UTC. Each profile found costs 2 credits: 500 usernames cost up to 1,000.
Hundreds of rows
A long column of formulas runs into Google's limits. "Each time a custom function is used in a spreadsheet, Sheets makes a separate call to the Apps Script server", says its guide, and by the hundred "this process can be slow". The quotas page allows 30 simultaneous executions per user and names two errors that "most commonly" come from custom functions called repeatedly in one spreadsheet: Script invoked too many times per second for this Google user account. and There are too many scripts running simultaneously for this Google user account. Re-entering a failed cell's formula tries again.
Google's remedy, one function over a whole range, does not fit here: that one call still has 30 seconds, and each lookup takes seconds. Its guide names the other way: "To edit arbitrary cells, use a custom menu to run a function instead." A run started from a menu may take 6 minutes. Add this to the same script, save, and reload the sheet:
function onOpen() {
SpreadsheetApp.getUi().createMenu("Pipefetch")
.addItem("Fill follower counts", "fillFollowers")
.addToUi();
}
function fillFollowers() {
fillColumn_((username) => {
const data = pipefetch_("/v1/instagram/profile", { username: username, posts: "false" });
return data ? [data.followerCount] : ["No such account"];
});
}
// Column A holds what to look up, from row 2 down; results go into column B and the columns after it.
// Rows that already have something in column B are skipped, so a second run carries on from there.
function fillColumn_(lookup) {
const sheet = SpreadsheetApp.getActiveSheet();
const rows = sheet.getLastRow() - 1;
if (rows < 1) return;
const values = sheet.getRange(2, 1, rows, 2).getValues();
const stopAt = Date.now() + 4 * 60 * 1000; // Google ends a run after 6 minutes
for (let i = 0; i < rows && Date.now() < stopAt; i++) {
const [input, filled] = values[i];
if (input === "" || filled !== "") continue;
const row = lookup(input);
sheet.getRange(i + 2, 2, 1, row.length).setValues([row]);
SpreadsheetApp.flush(); // write each row at once, so a later failure loses nothing
}
}Choose Pipefetch, then Fill follower counts, on the tab with usernames in column A. The first run asks you to authorize the script, which now edits the sheet and calls an outside address. It sends one request at a time and writes values, so nothing is fetched again later. It skips rows whose column B is filled and starts nothing new after 4 minutes: choose the item again to carry on. If a request fails, the run stops with the API's message and keeps what it wrote.
None of these routes keeps history: each gives the count at the moment you ask. For a reading a week, copy column B to a new column headed with the date, clear B, and run the menu again.
Which one should you use?
| Situation | Use |
|---|---|
| Business and creator accounts, and you have or will set up a Meta app | IG_FOLLOWERS_META, Meta's Business Discovery |
| Any public username, without a Meta app | IG_FOLLOWERS with Pipefetch |
| A few dozen rows | The formula, then Paste special, Values only |
| Hundreds of rows | The Fill follower counts menu |
The same pattern works for other sources: the guide to YouTube transcripts and stats in Google Sheets uses it for videos.
Try it with 100 free credits. No card needed. No login, cookies or proxies. Get an API key or read the docs.
Free tools for this
APIs used in this guide
More Instagram guides
- How to get an Instagram follower count in Python
- Instagram Basic Display API alternatives: what to use after the shutdown
- Instaloader 401 Unauthorized, 429 and "Login required": what to do
- How to calculate an Instagram engagement rate in Python
- How to get an Instagram follower count in Node.js
- How to get Instagram Reel views in Python
Guides for other sources
Every source
YouTube
- How to get a YouTube transcript in Python
- How to get a YouTube transcript in Node.js
- YouTube API quota exceeded: what the error means and how to fix it
- How to find a YouTube channel ID from a handle or URL
- How to download YouTube subtitles as SRT or VTT
- youtube-transcript-api RequestBlocked or IpBlocked: why it happens and how to fix it
- How to get YouTube comments in Python
- How to search YouTube from Python
- How to list a YouTube channel's videos in Python
- How to summarize a YouTube video with an LLM in Python
- How to get YouTube transcripts and video stats in Google Sheets
- How to get YouTube video views and likes in Python
- How to get YouTube transcripts in n8n, Make and Zapier
- LangChain YoutubeLoader fails on a server: why, and a loader that works
- How to get a YouTube channel's subscriber count in Python
- How to give Claude or Cursor access to YouTube (MCP server)
- How to get YouTube comments in Node.js
- How to analyze YouTube comments with an LLM in Python
- How to list a YouTube channel's Shorts in Python
- How to search YouTube from JavaScript
Websites
- Clearbit Logo API alternatives: get a company logo from its domain
- How to extract email addresses from a website in Python
- How to turn a web page into Markdown in Python
- How to detect what a website is built with, in Python
- How to get the contact emails and phone numbers of websites in Google Sheets
- How to build a LangChain tool that reads web pages and searches Google
- How to turn a web page into Markdown in JavaScript for RAG
- How to extract social media links from a website in Python
- How to get a website's favicon in Python
- How to check robots.txt in Python before you fetch a page
TikTok
- How to get a TikTok video's views and likes in Python
- How to get the comments of a TikTok video in Python
- How to get a TikTok follower count in Python
- TikTok Research API: who can get access, and what to do if you cannot
- How to get TikTok video views, likes and shares in Node.js
- How to get TikTok views, likes and follower counts in Google Sheets
- How to get a Facebook Page's posts without app review
- Is there a Facebook Marketplace API?
- Facebook Groups API alternatives after its removal in 2024
- How to get a Facebook Page's follower count and contact details in Python
- How to get Google search results in Python
- pytrends 429 TooManyRequestsError: what it means and what to do
- How to get Google Trends data in Python
- Why is Wyoming first in Google Trends?
- How to get Google search results in Node.js
- How to get Google search results into Google Sheets
- How to give an LLM live Google results with tool calling
Threads
- How to get LinkedIn company data in Python
- How to search LinkedIn jobs from Python
- How to get a LinkedIn company page's latest posts in Python