Google Sheets (Apps Script): download YouTube, TikTok and Instagram videos
With a few lines of Apps Script, a Google Sheet becomes a bulk resolver: paste URLs in column A, get titles and download links in B and C.
How it fits together
A custom menu runs a script that calls UrlFetchApp for each row, writing the results back to the sheet.
Google Sheets (Apps Script) example
function resolveAll() {const key = PropertiesService.getScriptProperties().getProperty("CRAWLFETCH_KEY");const sheet = SpreadsheetApp.getActiveSheet();const urls = sheet.getRange(2, 1, sheet.getLastRow() - 1, 1).getValues();urls.forEach(([url], i) => {if (!url) return;const res = UrlFetchApp.fetch("https://api.crawlfetch.com/v1/resolve?url=" + encodeURIComponent(url), {headers: { Authorization: "Bearer " + key },muteHttpExceptions: true,});const row = i + 2;if (res.getResponseCode() !== 200) {sheet.getRange(row, 2).setValue("error " + res.getResponseCode());return;}const v = JSON.parse(res.getContentText());sheet.getRange(row, 2, 1, 2).setValues([[v.title, v.downloadUrl]]);Utilities.sleep(250); // stay inside the rate limit});}
Notes for Google Sheets (Apps Script)
- Store the key under Project Settings → Script properties.
- Apps Script runs are capped at 6 minutes; process long sheets in batches.
FAQ
Can it save files to Google Drive?
Yes: DriveApp.createFile(UrlFetchApp.fetch(v.downloadUrl).getBlob()) for files within Apps Script's size limits.
Related
Last updated 2026-10-25