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:

JavaScript
/**
 * 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.

JavaScript
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

Terminal
=IG_FOLLOWERS(A2)   the follower count
=IG_PROFILE(A2)     name, followers, following, posts, verified, account type

Column 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 note Exceeded 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() or RAND() to make it refresh does not work: volatile arguments are not allowed, and the cell shows Loading... 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:

JavaScript
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?

SituationUse
Business and creator accounts, and you have or will set up a Meta appIG_FOLLOWERS_META, Meta's Business Discovery
Any public username, without a Meta appIG_FOLLOWERS with Pipefetch
A few dozen rowsThe formula, then Paste special, Values only
Hundreds of rowsThe 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

Every source

YouTube

Websites

TikTok

Facebook

Google

Threads

LinkedIn

App stores

Steam

X

Pinterest

Airbnb

Real estate

Keywords

Job boards

Eventbrite

Shopify stores

Public tenders

All guides