Google Sheets Sync — Apify Dataset Export, Upsert & Import
Pricing
from $3.00 / 1,000 sheet sync completed
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
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
3 hours ago
Last modified
Categories
Features
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.
| Event | Description | FREE | BRONZE | SILVER | GOLD+ |
|---|---|---|---|---|---|
apify-actor-start | One-time container start fee | $0.00005 | $0.00005 | $0.00005 | $0.00005 |
sheet-sync-completed | Charged once per successful sync ($0 on failure) | $0.0050 | $0.0040 | $0.0035 | $0.0030 |
row-synced | Per 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.084on BRONZE,$0.063on 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+0row charges =$0.005 - Failed run (bad sheet ID, missing permission, or dry run):
$0.00sync/row charge
3-Step Quick Start
Option A — Import Any Public Google Sheet (Zero Setup)
- Keep Operation Mode set to
import_public. - Paste any public Google Sheets URL (or Spreadsheet ID) and optional
sheetName. - Click Start — receive clean typed JSON rows in the Dataset tab and a downloadable
OUTPUT.csvin 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
- Share your Google Sheet with your Google Cloud Service Account
client_emailas Editor (or Viewer forimport_service_account). - Set
operationMode: "export_service_account", pick your Source Apify Dataset (or wire{{resource.defaultDatasetId}}via Apify Add integration), and pasteserviceAccountJson(encrypted at rest; never logged). - Choose
writeMode:"append","replace", or"upsert"(withprimaryKeyColumn, 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)
- 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).
- Copy the
https://script.google.com/macros/s/.../execWeb App URL intoappsScriptUrland setoperationMode: "export_apps_script". - Optionally set matching
webhookSecretin both the script and Actor input, then click Start.
function doPost(e) {const SECRET = ""; // Optional: match webhookSecret in Actor inputconst 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_PERMISSIONSsafe:sourceDatasetIddeclaresresourceType: "dataset"withresourcePermissions: ["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 readpayload.resource.defaultDatasetId. Explicit inputs always take precedence. - Incremental Watch Mode: Enable
watchMode: trueandonlyNew: truewith a stablewatchStateKey(stored in Named Key-Value Storestructmint-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
recordsarrays or upstream Apify Datasets into Google Sheets with automatic nested JSON flattening andupsertdeduplication - Preview schema flattening and download
OUTPUT.csvrisk-free usingdryRun: true
Output Artifacts
Every run produces:
- 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). OUTPUT(Key-Value Store JSON): Full run summary, diagnostics, sample rows, billing breakdown, and warnings.OUTPUT.csv(Key-Value Store CSV): Normalized RFC 4180 CSV snapshot of synced rows.