Calling Snapshot Site from Google Apps Script: Screenshots Straight from a Spreadsheet

Calling Snapshot Site from Google Apps Script: Screenshots Straight from a Spreadsheet

author

Snapshot Site Team

01 Feb 2026 - 02 Mins read

For teams that already track URLs in a Google Sheet, Google Apps Script offers a way to call the Snapshot Site API directly from the spreadsheet, without routing through Zapier, Make, or any other automation platform in between. UrlFetchApp, Apps Script's built-in HTTP client, handles the request the same way any other language's HTTP library would.

What This Script Does

A custom menu item runs a function that loops over every row in a sheet, captures a screenshot for the URL in each one, and writes the result back into the adjacent column.

The Script

function captureScreenshots() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  const rows = sheet.getDataRange().getValues();
  const apiKey = "YOUR_API_KEY";

  for (let i = 1; i < rows.length; i++) {
    const url = rows[i][0];
    if (!url) continue;

    const response = UrlFetchApp.fetch("https://api.prod.ss.snapshot-site.com/api/v1/screenshot", {
      method: "post",
      contentType: "application/json",
      headers: { "x-snapshotsiteapi-key": apiKey },
      payload: JSON.stringify({
        url: url,
        format: "png",
        width: 1440,
        fullSize: true,
        hideCookie: true,
      }),
    });

    const data = JSON.parse(response.getContentText());
    sheet.getRange(i + 1, 2).setValue(data.link);
  }
}

This assumes URLs live in column A and the screenshot link should land in column B — adjust the column indices to match your sheet's layout.

Adding a Custom Menu

To make the script runnable without opening the Apps Script editor every time, add a simple menu trigger:

function onOpen() {
  SpreadsheetApp.getUi()
    .createMenu("Snapshot Site")
    .addItem("Capture Screenshots", "captureScreenshots")
    .addToUi();
}

Now anyone with edit access to the sheet can run the capture job from a menu, without needing to see or touch the script itself.

Storing the API Key Safely

Rather than hardcoding the key directly in the script (visible to anyone who opens the editor), store it in Apps Script's Properties Service and read it at runtime:

const apiKey = PropertiesService.getScriptProperties().getProperty("SNAPSHOT_SITE_API_KEY");

Set the property once via Project Settings → Script Properties in the Apps Script editor, and it stays out of the visible script body.

Adding a Time-Based Trigger

Apps Script supports time-based triggers configured from the editor's Triggers panel — pointing one at captureScreenshots turns this from a manual menu action into a recurring job, similar in spirit to the scheduled monitoring pattern in Visual Uptime Monitoring, but running entirely inside the spreadsheet with no external service.

When This Fits Better Than a No-Code Automation Platform

If a Google Sheet is genuinely the entire workflow — no other app needs to be involved, no complex branching — Apps Script skips the extra step of connecting a third-party automation platform at all. For anything that needs to route results elsewhere (Slack, a database, a second app), Sending Snapshot Site Screenshots to Slack and Google Sheets with Zapier covers that broader case.

For teams whose workflow already lives entirely in Sheets, Snapshot Site is one UrlFetchApp.fetch call away, with nothing else to set up.

Recent Articles

Subscribe to Snapshot Site API

Snapshot Site is a powerful API that allows you to capture full-page, high-resolution screenshots of any website with pixel-perfect accuracy.
Simply send a URL to the API to generate a complete snapshot — not just the visible area — covering entire web pages, scrolling content, landing pages, blogs, news articles, social media posts, videos, and more.
Designed for developers, designers, marketers, and journalists,
Snapshot Site makes it easy to integrate web page capture into your applications, workflows, and automation tools.

Subscribe Now
bg wave