Use SocialCrawl with Google Sheets
Pull social media data into Google Sheets without writing a server.
You can pull SocialCrawl data into a Google Sheet with a short Apps Script. One function calls the API and writes the rows into a tab. Setup takes three steps: store the key, paste the script, run it.
The IMPORTDATA function cannot send a header, so it cannot carry the API key. Use Apps Script instead.
Before you start
Create an API key in the dashboard under API Keys. In the Apps Script editor, open Project Settings and add a script property named SOCIALCRAWL_API_KEY. Script properties are not visible in a cell or in the sheet's file. Never type the key into a cell. Prove the key with a call that costs nothing:
curl "https://www.socialcrawl.dev/v1/credits/balance" \
-H "x-api-key: sc_your_key_here"A reply with "success": true and your balance in data.balance means the key works.
Connect
In the sheet, open Extensions, then Apps Script, and paste this function:
function loadVideos() {
const key = PropertiesService.getScriptProperties().getProperty("SOCIALCRAWL_API_KEY");
const res = UrlFetchApp.fetch(
"https://www.socialcrawl.dev/v1/tiktok/profile/videos?handle=mrbeast",
{ headers: { "x-api-key": key }, muteHttpExceptions: true }
);
const body = JSON.parse(res.getContentText());
if (res.getResponseCode() !== 200 || !body.success) {
SpreadsheetApp.getActive().toast(body.error.message, "SocialCrawl", 10);
return;
}
const rows = body.data.items.map((item) => [item.id]);
SpreadsheetApp.getActiveSheet().getRange(1, 1, rows.length, 1).setValues(rows);
}Run loadVideos once and approve the permissions the editor asks for. Change the path and the query to call any other endpoint, and change the mapped columns to the fields you want.
Read the answer
Every response has the same shape. Branch on success. A list puts its rows in data.items, and pagination.next_cursor is the token for the next page.
{
"success": true,
"data": { "items": [{ "id": "7654638524729216287" }] },
"pagination": { "next_cursor": "sc.eyJ2Ijoy…", "has_more": true },
"credits_used": 1,
"credits_remaining": 99
}To read the next page, add &cursor= with the next_cursor value to the URL, and stop when has_more is false. See Pagination.
When it stops
muteHttpExceptions: true keeps a refused call from throwing, so the script can read the answer. The script above shows error.message in a toast on the sheet. No email is sent.
When credits run out, the status is 402 and error.type is INSUFFICIENT_CREDITS. Read error.message for the text and error.details.checkout_url for the link that opens checkout. When the link is absent, error.details.top_up_url opens the billing page.
Never retry a 402, because it fails until credits are added. Retry a 429 after the seconds in the Retry-After header, and a 502, 503 or 504 after a short backoff. See Errors.
What a run costs
It depends on the endpoint, and some endpoints are priced by what they return. Endpoint pricing lists each one, and Credits explains cache hits and refunds. Before you schedule a refresh, GET /v1/utility/estimate quotes a call for 0 credits.
Refresh on a schedule
In the Apps Script editor, open Triggers and add a time-driven trigger for loadVideos. Each run is a real call, so it costs credits every time it fires. Set the interval to how often the data changes.
