Allscreenshots
Sign inGet an API key
Blog

Tutorial

Automate website screenshots from Google Sheets

Riley ThompsonUpdated 6 min read

Google Sheets is the easiest way to batch-capture website screenshots. List your URLs in column A, run a script, and get screenshot links in column B. No servers, no installs, no dependencies.

What you'll build

A Google Apps Script that reads URLs from your spreadsheet, captures a screenshot of each one via the Allscreenshots API, and writes the screenshot URL back to the sheet. You can also display thumbnails directly in cells.

Prerequisites

Step 1: Set up your spreadsheet

Create a Google Sheet with this structure:

A (URL)B (Screenshot URL)C (Thumbnail)
https://example.com(auto-filled)(auto-filled)
https://github.com(auto-filled)(auto-filled)

Column A is where you put your URLs. Columns B and C will be filled by the script.

Step 2: Open Apps Script

Go to Extensions → Apps Script. This opens the script editor.

Delete any existing code and paste:

javascript
function captureScreenshots() { const API_KEY = PropertiesService.getScriptProperties() .getProperty('SCREENSHOT_API_KEY'); if (!API_KEY) { SpreadsheetApp.getUi().alert( 'API key not set. Go to Project Settings > Script Properties and add SCREENSHOT_API_KEY.' ); return; } const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); const lastRow = sheet.getLastRow(); if (lastRow < 2) { SpreadsheetApp.getUi().alert('No URLs found. Add URLs starting in cell A2.'); return; } const urls = sheet.getRange(2, 1, lastRow - 1, 1).getValues().flat(); let captured = 0; for (let i = 0; i < urls.length; i++) { const url = urls[i]; if (!url) continue; try { const response = UrlFetchApp.fetch( 'https://api.allscreenshots.com/v1/screenshots', { method: 'post', headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json', }, payload: JSON.stringify({ url: url, fullPage: true, responseType: 'url', viewport: { width: 1280, height: 800 }, blockAds: true, }), } ); const result = JSON.parse(response.getContentText()); const row = i + 2; // Column B: Screenshot URL sheet.getRange(row, 2).setValue(result.storageUrl); // Column C: Thumbnail using IMAGE formula sheet.getRange(row, 3).setFormula( '=IMAGE("' + result.storageUrl + '", 1)' ); captured++; } catch (error) { sheet.getRange(i + 2, 2).setValue('Error: ' + error.message); } } SpreadsheetApp.getUi().alert( 'Done! Captured ' + captured + ' screenshots out of ' + urls.length + ' URLs.' ); }

Step 3: Store your API key

In the Apps Script editor:

  1. Click the gear icon (Project Settings) in the left sidebar
  2. Scroll to Script Properties
  3. Click Add script property
  4. Property: SCREENSHOT_API_KEY
  5. Value: your API key from the Allscreenshots dashboard

This keeps your API key out of the code.

Step 4: Run the script

Back in the script editor, click Run → select captureScreenshots. The first time, you'll need to authorize the script to access your spreadsheet and make external requests.

After authorization, the script processes each URL and fills in columns B and C.

Displaying thumbnails

The script uses the =IMAGE() formula to display thumbnails directly in cells. To make them look good:

  1. Select column C
  2. Right-click → Resize column → set to 300px
  3. Select all data rows → right-click → Resize rows → set to 200px

Now you'll see visual thumbnails of every website right in your spreadsheet.

Scheduling automatic captures

To recapture screenshots on a schedule:

  1. In Apps Script, click the clock icon (Triggers) in the left sidebar
  2. Click Add Trigger
  3. Function: captureScreenshots
  4. Event source: Time-driven
  5. Type: Day timer (or weekly, hourly, etc.)
  6. Time: pick your preferred time

The script will now run automatically and update all screenshots.

Handling large batches

Google Apps Script has a 6-minute execution time limit. For large URL lists:

javascript
function captureScreenshotsBatch() { const API_KEY = PropertiesService.getScriptProperties() .getProperty('SCREENSHOT_API_KEY'); const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); const lastRow = sheet.getLastRow(); for (let i = 1; i < lastRow; i++) { const url = sheet.getRange(i + 1, 1).getValue(); const existing = sheet.getRange(i + 1, 2).getValue(); // Skip rows that already have screenshots if (!url || existing) continue; try { const response = UrlFetchApp.fetch( 'https://api.allscreenshots.com/v1/screenshots', { method: 'post', headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json', }, payload: JSON.stringify({ url, fullPage: true }), } ); const result = JSON.parse(response.getContentText()); sheet.getRange(i + 1, 2).setValue(result.storageUrl); } catch (error) { // Stop if we're running out of time if (error.message.includes('time')) break; sheet.getRange(i + 1, 2).setValue('Error'); } } }

This version skips rows that already have screenshots, so you can run it multiple times to process large lists incrementally.

Wrapping up

Google Sheets plus Allscreenshots is a simple, powerful way to batch-capture website screenshots. No servers to manage, no browser infrastructure, and the familiar spreadsheet interface your team already knows.

For more details, see the Google Sheets integration page.

Choose an automation workflow

Use screenshot automation for repeated captures and Google Sheets integration for a URL list maintained by your team. The bulk API handles queued batches; the scheduled capture guide covers cadence, delivery and change detection.

If you are replacing an existing provider, review the ScreenshotOne comparison or Urlbox comparison for current pricing sources, capture settings and a migration checklist. API authentication explains how to keep your key on the server.

Find out how easy it is to capture and share pixel-perfect screenshots at scale using Allscreenshots. Sign up for a free account and start integrating your first screenshot API call today.

Start with one request

Free plan: 100 screenshots. No credit card.

Get an API key
  • Full-page captures
  • Popups and repeated sticky bars removed
  • Markdown, JSON and PDF output
  • Crawl a site from one URL
  • Desktop, tablet and phone in one image
  • Works in n8n, Make and Zapier
  • MCP server for AI assistants