Google Sheets Sync — Apify Dataset Export, Upsert & Import avatar

Google Sheets Sync — Apify Dataset Export, Upsert & Import

Pricing

from $3.00 / 1,000 sheet sync completed

Go to Apify Store
Google Sheets Sync — Apify Dataset Export, Upsert & Import

Google Sheets Sync — Apify Dataset Export, Upsert & Import

Sync Apify Datasets to Google Sheets reliably without OAuth crashes. Supports Service Account, 1-click Apps Script & public import, upsert, JSON flattening & 429 retries. $0.005/sync + $0.10/1,000 rows · Failed runs free · AI Agent & MCP ready.

Pricing

from $3.00 / 1,000 sheet sync completed

Rating

0.0

(0)

Developer

StructMint

StructMint

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

3 hours ago

Last modified

Features

Limited permissions

Share

Google Sheets Sync — Reliable Apify Dataset Export, Upsert & Import

Sync any Apify Dataset, JSON array, or CSV directly to Google Sheets — or import any public or private Google Sheet into a typed Apify Dataset & OUTPUT.csv — without broken OAuth popups, nested JSON write crashes, or HTTP 429 quota failures.

Built for high reliability at 256–512 MB RAM under LIMITED_PERMISSIONS:

  • Zero-Auth Public Import (1-Click Ready): Click Start immediately to read any public or anyone-with-link Google Sheet into structured JSON Dataset rows and OUTPUT.csv.
  • Service Account RS256 OAuth2: Direct Google Sheets API v4 reads and writes with automatic missing-tab creation, 5,000-row chunked batches, and exponential backoff on HTTP 429 / 503.
  • 1-Click Google Apps Script Mode (Zero GCP Console): Paste a 25-line Apps Script into your sheet and export immediately without creating a Google Cloud project.
  • Upsert Without Duplicates + Nested JSON Flattening: Update matching rows in-place by primaryKeyColumn, skip unchanged rows free, flatten nested objects (pricing.amount), and skip previously synced rows across schedules with Watch Mode.

Transparent Pay-Per-Event Pricing

Failed runs and Dry Runs are free ($0 sync and row charges). Skipped, duplicate, unchanged upsert, and Watch Mode rows incur $0 row charges.

EventDescriptionFREEBRONZESILVERGOLD+
apify-actor-startOne-time container start fee$0.00005$0.00005$0.00005$0.00005
sheet-sync-completedCharged once per successful sync ($0 on failure)$0.0050$0.0040$0.0035$0.0030
row-syncedPer imported or written row ($0 on skipped/unchanged)$0.00010$0.00008$0.00007$0.00006

Exact Cost Examples (FREE Tier Ceiling)

  • Sync 1,000 rows to or from Google Sheets: $0.005 + 1,000 × $0.0001 = $0.105 ($0.084 on BRONZE, $0.063 on GOLD+)
  • Sync 10,000 rows (chunked in two 5,000-row batches): $0.005 + 10,000 × $0.0001 = $1.005
  • Scheduled Watch Mode run with 0 changed rows: $0.005 + 0 row charges = $0.005
  • Failed run (bad sheet ID, missing permission, or dry run): $0.00 sync/row charge

3-Step Quick Start

Option A — Import Any Public Google Sheet (Zero Setup)

  1. Keep Operation Mode set to import_public.
  2. Paste any public Google Sheets URL (or Spreadsheet ID) and optional sheetName.
  3. Click Start — receive clean typed JSON rows in the Dataset tab and a downloadable OUTPUT.csv in Key-Value Store.
{
"operationMode": "import_public",
"spreadsheetUrlOrId": "https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit",
"sheetName": "Class Data",
"inferTypes": true,
"maxRows": 1000
}

Option B — Export & Upsert Apify Dataset via Google Service Account

  1. Share your Google Sheet with your Google Cloud Service Account client_email as Editor (or Viewer for import_service_account).
  2. Set operationMode: "export_service_account", pick your Source Apify Dataset (or wire {{resource.defaultDatasetId}} via Apify Add integration), and paste serviceAccountJson (encrypted at rest; never logged).
  3. Choose writeMode: "append", "replace", or "upsert" (with primaryKeyColumn, e.g. "sku" or "id"). Missing tabs are created automatically.
{
"operationMode": "export_service_account",
"spreadsheetUrlOrId": "https://docs.google.com/spreadsheets/d/<YOUR_SHEET_ID>/edit",
"sheetName": "Catalog",
"writeMode": "upsert",
"primaryKeyColumn": "sku",
"sourceDatasetId": "{{resource.defaultDatasetId}}",
"flattenNestedObjects": true,
"arrayJoinDelimiter": ", ",
"watchMode": true,
"onlyNew": true,
"watchStateKey": "daily-catalog-sync"
}

Option C — 1-Click Apps Script Export (Zero GCP Console)

  1. Open your Google Sheet → Extensions → Apps Script, paste the 25-line template below, and click Deploy → New deployment → Web app (Execute as: Me, Who has access: Anyone).
  2. Copy the https://script.google.com/macros/s/.../exec Web App URL into appsScriptUrl and set operationMode: "export_apps_script".
  3. Optionally set matching webhookSecret in both the script and Actor input, then click Start.
function doPost(e) {
const SECRET = ""; // Optional: match webhookSecret in Actor input
const p = JSON.parse(e.postData.contents);
if (SECRET && p.webhookSecret !== SECRET) {
return ContentService.createTextOutput(JSON.stringify({ ok: false, error: "Unauthorized" })).setMimeType(ContentService.MimeType.JSON);
}
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sh = ss.getSheetByName(p.sheetName || "Apify Data") || ss.insertSheet(p.sheetName || "Apify Data");
if (p.writeMode === "replace" && p.isFirstBatch) sh.clearContents();
if (sh.getLastRow() === 0 && p.headers.length) sh.appendRow(p.headers);
const headers = sh.getRange(1, 1, 1, Math.max(sh.getLastColumn(), p.headers.length)).getValues()[0];
let inserted = 0, updated = 0;
if (p.writeMode === "upsert" && p.primaryKeyColumn) {
const pkCol = headers.indexOf(p.primaryKeyColumn);
const vals = sh.getLastRow() > 1 && pkCol >= 0 ? sh.getRange(2, pkCol + 1, sh.getLastRow() - 1, 1).getValues() : [];
const byKey = Object.fromEntries(vals.map((r, i) => [String(r[0]).trim(), i + 2]).filter(([k]) => k));
const add = [];
for (const r of p.rows) {
const k = pkCol >= 0 ? String(r[pkCol] ?? "").trim() : "";
if (k && byKey[k]) { sh.getRange(byKey[k], 1, 1, r.length).setValues([r]); updated++; } else add.push(r);
}
if (add.length) { sh.getRange(sh.getLastRow() + 1, 1, add.length, add[0].length).setValues(add); inserted = add.length; }
} else if (p.rows.length) { sh.getRange(sh.getLastRow() + 1, 1, p.rows.length, p.rows[0].length).setValues(p.rows); inserted = p.rows.length; }
return ContentService.createTextOutput(JSON.stringify({ ok: true, inserted, updated })).setMimeType(ContentService.MimeType.JSON);
}

Native Apify Add integration & Scheduled Pipelines

Attach this Actor directly to the Integrations → Add integration tab of any upstream scraper without writing glue code:

  • LIMITED_PERMISSIONS safe: sourceDatasetId declares resourceType: "dataset" with resourcePermissions: ["READ"], so Apify grants read-only access to the triggering run's private dataset automatically.
  • Automatic webhook fallback: Map "sourceDatasetId": "{{resource.defaultDatasetId}}", or leave source fields empty to automatically read payload.resource.defaultDatasetId. Explicit inputs always take precedence.
  • Incremental Watch Mode: Enable watchMode: true and onlyNew: true with a stable watchStateKey (stored in Named Key-Value Store structmint-gsheets-watch-v1) so recurring schedules only sync new or modified rows.

AI Agents & MCP

Connect this Actor directly to Claude, Cursor, Windsurf, or any MCP-compatible AI agent using the Apify MCP Server URL:

https://mcp.apify.com?tools=structmint/google-sheets-dataset-sync

AI agents can:

  • Read structured JSON rows from any public or private Google Sheet (import_public / import_service_account)
  • Write inline records arrays or upstream Apify Datasets into Google Sheets with automatic nested JSON flattening and upsert deduplication
  • Preview schema flattening and download OUTPUT.csv risk-free using dryRun: true

Output Artifacts

Every run produces:

  1. Default Dataset (results): Clean typed spreadsheet rows (on import modes) or a structured sync receipt with row counts, batch counts, and column list (on export modes).
  2. OUTPUT (Key-Value Store JSON): Full run summary, diagnostics, sample rows, billing breakdown, and warnings.
  3. OUTPUT.csv (Key-Value Store CSV): Normalized RFC 4180 CSV snapshot of synced rows.