How to get TikTok views, likes and follower counts in Google Sheets
Checked on 2026-11-24.
Paste TikTok video links in column A and =TIKTOK_VIDEO(A2) fills the row with plays, likes, comments, shares and saves; give =TIKTOK_PROFILE(A2) a username and it returns followers, likes and the number of videos. Neither the built-in import functions nor TikTok's official APIs get these numbers into a sheet, so the functions below call an HTTP API from Apps Script.
What TikTok's own routes give a spreadsheet
oEmbed, TikTok's official address that answers without an app or an approval, has no counts. Opened on 24 November 2026, its answer for the video in the reference held the embed code and the video's ID and nothing else; for https://www.tiktok.com/@nasa, the title "NASA's Creator Profile", the display name and the profile link. The built-in IMPORTDATA could not read that JSON anyway: it takes ".csv (comma-separated value) or .tsv (tab-separated value)" data.
The official APIs with numbers are built for other jobs. The Display API's video endpoint starts from "an authorized user and a list of video IDs", someone who logged in to your app, and checks that the videos are theirs; see a video's views and likes in Python. The Research API's FAQ answers "No." to "I am a creator, advertiser, or commercial user. Am I eligible for access to the Research Tools?", and its statistics "can take up to 10 days to update"; the conditions are in the guide on Research API access.
As for IMPORTXML on a TikTok page, what TikTok sends to it is documented by neither company, so this guide shows no such formula.
1. Paste the script
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;
}
/**
* Plays, likes, comments, shares and saves of a TikTok video, across five cells.
* @customfunction
*/
function TIKTOK_VIDEO(link) {
if (!link) return "";
const data = pipefetch_("/v1/tiktok/video", { video: link });
if (!data) return "Video not found";
return [[data.playCount, data.likeCount, data.commentCount, data.shareCount, data.collectCount]];
}
/**
* Followers, total likes and number of videos of a TikTok account, across three cells.
* @customfunction
*/
function TIKTOK_PROFILE(username) {
if (!username) return "";
const data = pipefetch_("/v1/tiktok/profile", { username: username });
if (!data) return "No such account";
return [[data.followerCount, data.likeCount, data.videoCount]];
}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.
2. Use the functions
=TIKTOK_VIDEO(A2) plays, likes, comments, shares and saves, across five cells
=TIKTOK_PROFILE(A2) followers, total likes and number of videos, across three cellsDrag the formula down; the cells to its right have to be empty for the numbers to spill into. A video link has to be the full address a browser shows, https://www.tiktok.com/@user/video/ followed by the ID. A short vm.tiktok.com link from the app is refused with a message in the cell and no charge: open it and paste the address it leads to. For accounts, a username, a handle with @ or a profile link all work. Each video or account found costs 1 credit; a deleted or private video and an account that does not exist cost nothing.
The two differ in precision. A video's counts are as precise as TikTok's video page, which rounds large numbers the way it displays them: 160.3K plays arrive as 160300, while 5621 comments arrive in full. Profile counts are exact: nasa had 2201384 followers on 19 November 2026, where its profile shows 2.2M. The profile reference lists more fields, such as the bio link and the business flag.
Where it stops: it returns what TikTok shows a visitor who is not logged in: no list of an account's videos or followers, and no video file. When TikTok does not answer, the cell shows an error, the request costs nothing, and re-entering the formula tries again. It is not an official TikTok API, and Pipefetch is not affiliated with TikTok. TikTok's Terms of Service list among the things users must not do: "extract any data or content from the Platform using any automated system or software that is not provided by TikTok or approved in writing by TikTok". If you need TikTok's written permission, use an official route.
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. One credit per video or account found: 500 video links cost up to 500.
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 video stats", "fillVideos")
.addItem("Fill account stats", "fillAccounts")
.addToUi();
}
function fillVideos() {
fillColumn_((link) => {
const data = pipefetch_("/v1/tiktok/video", { video: link });
return data ? [data.playCount, data.likeCount, data.commentCount, data.shareCount, data.collectCount] : ["Video not found"];
});
}
function fillAccounts() {
fillColumn_((username) => {
const data = pipefetch_("/v1/tiktok/profile", { username: username });
return data ? [data.followerCount, data.likeCount, data.videoCount] : ["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 video stats, on the tab with video links 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.
Fill account stats does the same for a tab of usernames. To follow a campaign, copy the filled columns to a tab named after the date, clear them, and run the menu again.
Which one should you use?
| Situation | Use |
|---|---|
| You only want to show a video on a page | oEmbed or TikTok's Embed Player |
| Creators connect their own TikTok accounts to your product | The Display API |
| An approved research project | The Research API |
| Numbers for a list of public videos or accounts in a sheet | TIKTOK_VIDEO and TIKTOK_PROFILE with Pipefetch |
| Hundreds of rows | The Pipefetch menu |
For the same numbers from code, see how to get a TikTok follower count in Python.
Try it with 100 free credits. No card needed. No scraper to build or maintain. Get an API key or read the docs.
APIs used in this guide
-
1 credit
TikTok Video API
Plays, likes, comments, shares and saves of one TikTok video, with its caption, hashtags, sound and creator.
GET /v1/tiktok/video -
1 credit
TikTok Profile API
Exact followers, likes and video count of a TikTok account, with its bio, bio link, verified, business and TikTok Shop flags.
GET /v1/tiktok/profile
More TikTok guides
- 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
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
- 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 follower counts in Google Sheets
- How to get Instagram Reel views in Python
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
- 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