Google Sheets Export Pro: Append, Upsert & Replace avatar

Google Sheets Export Pro: Append, Upsert & Replace

Under maintenance

Pricing

from $0.50 / 1,000 row writtens

Go to Apify Store
Google Sheets Export Pro: Append, Upsert & Replace

Google Sheets Export Pro: Append, Upsert & Replace

Under maintenance

Export Apify datasets or JSON to Google Sheets reliably: append, upsert by key (no duplicates) or replace. Batched, auto-retry on 429, resumable. Pay per row.

Pricing

from $0.50 / 1,000 row writtens

Rating

0.0

(0)

Developer

Grace M. Hartwell

Grace M. Hartwell

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

24 days ago

Last modified

Features

Limited permissions

Share

Hartwell Toolworks

Google Sheets Export Pro exports Apify datasets or any JSON items to Google Sheets, and it keeps working on large and repeated exports. Choose append (add rows), upsert (update rows by a key column, add new ones, no duplicates) or replace (overwrite the tab). Writes are batched, retried automatically on Google's 429 Too Many Requests and 5xx errors, and resumed after a migration. Every error tells you exactly what to fix. You pay $0.50 per 1,000 rows written plus $0.005 per run. Unchanged rows, skipped rows and dry runs are free.

What can you use Google Sheets Export Pro for?

  • 📈 Scraper → Google Sheets every day: send product prices, job posts, leads or reviews to a sheet after each scheduled run.
  • 🔁 Keep one up-to-date table instead of duplicates: upsert by url, id or sku. Existing rows are updated in place, new items are appended, unchanged rows are skipped and cost nothing.
  • 🧹 Live dashboards: replace refreshes a tab that charts, pivot tables or Looker Studio read from.
  • 🔌 n8n, Make and Zapier workflows: pass JSON items or a dataset ID and get a summary back.
  • 🧩 Clean data first, then export: chain it after Merge & Deduplicate Datasets to merge several scraper runs, then upsert the result into one sheet.

Why it is more reliable

  • ✅ Pre-flight checks before anything is written: credentials, the spreadsheet ID, edit access, the tab and the 10-million-cell limit.
  • 🧱 Idempotent writes: every batch is written to explicit row numbers, so a retry or a resumed run overwrites the same rows and never appends them twice.
  • 🔄 Backoff on 429/5xx: exponential backoff with jitter, honours Retry-After, up to 9 attempts (max 64 s wait), plus a client-side throttle (default 50 requests per minute, below Google's per-user quota of 60).
  • 💾 Resumable: a checkpoint (STATE in the run's key-value store) is saved after every batch. After a platform migration or restart the run continues where it stopped and does not charge the same rows again.
  • 📏 Within Sheets limits: requests are split by rows (batchSize) and by size (about 2 MB), the grid is expanded before writing, the 10,000,000-cell limit is checked up front, and cells over 50,000 characters are truncated and reported.
  • 🧠 Quota-friendly upsert: the existing sheet is read in a few large windows, about 200,000 cells per request. Only a 32-bit hash per cell is kept in memory, at most 40 MB for a full 10M-cell spreadsheet.
  • 🔐 Credentials stay secret: the key is a secret input field (encrypted by Apify) and is never logged. Error messages are redacted.
  • 🔒 Limited permissions: the Actor only needs READ access to the one dataset you pick. It uses no Standby mode and defaults to 512 MB of memory.

How to export an Apify dataset to Google Sheets

  1. Create a service account (one time, about 3 minutes):
    1. Open Google Cloud Console → create or select a project.
    2. APIs & Services → Library → Google Sheets API → Enable.
    3. IAM & Admin → Service accounts → Create service account (no roles needed).
    4. Open the account → Keys → Add key → Create new key → JSON. A .json file downloads.
  2. Share your spreadsheet with the service account's e-mail (client_email in the JSON, e.g. sheets-export@your-project.iam.gserviceaccount.com) as Editor. Untick "Notify people".
  3. In this Actor:
    • Dataset: pick the dataset, e.g. the default dataset of your scraper run.
    • Spreadsheet ID or URL: paste the sheet's URL.
    • Sheet (tab) name: e.g. Products. The tab is created if it is missing.
    • Write mode: append, upsert (+ Key column(s), e.g. url) or replace.
    • Service account key (JSON): paste the whole JSON file.
  4. Click Start. The summary shows the sheet link and the number of rows appended, updated and skipped.

Tip: turn on Dry run first. It checks access and shows what would be appended or updated, without writing or charging rows. Without credentials, it previews the columns offline.

Write modes

ModeWhat happensTypical use
appendRows are added below the last row with data. New fields become new columns at the end of the header.Logs, history, "everything we ever scraped"
upsertRows whose key column(s) already exist are updated in place. New keys are appended. Unchanged rows are skipped (free). If a key appears several times in the input, the last occurrence wins, so no duplicate rows are created.Price trackers, CRM-style lead lists, job boards, daily scrapes
replaceThe tab is overwritten with this data. Old rows and columns beyond the new data are cleared after the new rows are written, so the tab is never empty in between.Dashboards, "current snapshot" tabs

Columns, nested JSON and arrays

  • Flattening: {"price": {"value": 9.5, "currency": "EUR"}} → columns price.value and price.currency (dot notation, up to maxDepth).
  • Arrays: join (["a","b"] → a, b; arrays of objects become JSON), json, or index (tags.0, tags.1, …).
  • Header handling: merge keeps your existing header order and adds new columns at the end. existing-only never adds columns; extra fields are dropped and listed in the summary.
  • Column order / whitelist: columns: ["title", "price.value", "url"]. Turn on onlyListedColumns to export only these columns.
  • Value input option: RAW (default; values stay exactly as sent, numbers stay numbers) or USER_ENTERED (Google parses dates and percentages). Key cells always stay text, so 00123 never turns into 123. Values starting with = are written as text, so scraped content cannot run formulas (escapeFormulas).
  • If the Actor writes the header into an empty tab, the header row is frozen.

Input example

{
"datasetId": "aBcD1234EfGh5678",
"spreadsheetId": "https://docs.google.com/spreadsheets/d/1AbC...xyz/edit#gid=0",
"sheetName": "Products",
"mode": "upsert",
"keyColumns": ["url"],
"columns": ["url", "title", "price.value", "price.currency"],
"arrayMode": "join",
"valueInputOption": "RAW",
"batchSize": 1000,
"serviceAccountKey": "{ \"type\": \"service_account\", ... }"
}
FieldDefaultDescription
datasetId / items–Dataset to export (READ access via the picker), or an array of JSON items. A webhook payload with resource.defaultDatasetId also works.
datasetOffset / datasetLimit0 / allExport only a slice, e.g. to split very large datasets.
spreadsheetId–Spreadsheet URL or ID. A #gid= in the URL selects that tab if sheetName is empty.
sheetName / createSheetIfMissingfirst tab / trueTarget tab, created if it is missing.
modeappendappend, upsert or replace.
keyColumns–Key for upsert, e.g. ["url"] or ["shop", "product.id"].
skipUnchangedRows / missingFieldsOnUpdate / rowsWithoutKeytrue / keep / skipUpsert details.
caseInsensitiveKeys / trimKeysfalse / trueHow keys are compared.
columns / onlyListedColumns / headerMode– / false / mergeColumn order, whitelist and header handling.
flattenObjects / arrayMode / arraySeparator / maxDepthtrue / join / ", " / 10Flattening.
valueInputOption / escapeFormulas / freezeHeaderRowRAW / true / trueHow values are written.
serviceAccountKey / oauthAccessToken–Credentials (secret fields). The service account is recommended. OAuth tokens expire after about 1 hour.
batchSize / maxRequestsPerMinute / maxRowsToWrite1000 / 50 / no limitLimits.
dryRunfalseCheck and count without writing or charging rows.

Output

The Actor stores a summary as OUTPUT in the key-value store and as one record in the dataset:

{
"status": "SUCCEEDED",
"mode": "upsert",
"sheetUrl": "https://docs.google.com/spreadsheets/d/1AbC...xyz/edit#gid=0",
"sheetTitle": "Products",
"itemsRead": 51000,
"rowsWritten": 6000,
"rowsAppended": 1000,
"rowsUpdated": 5000,
"rowsUnchanged": 45000,
"rowsSkippedMissingKey": 0,
"duplicateKeysInInput": 0,
"columns": ["id", "title", "price.value", "price.currency", "stock", "tags", "seller.name", "seller.city", "url"],
"columnsAdded": [],
"rowsCharged": 6000,
"apiRequests": 32,
"apiRetries": 0,
"stoppedReason": null
}

If a run fails, the summary has status: "FAILED", an errorCode and an error message that says what to fix.

Error messages you might see (and what to do)

errorCodeMeaning
SHEET_NOT_SHAREDThe sheet is not shared with the service account, or only as Viewer. The message shows the exact e-mail to add as Editor.
API_NOT_ENABLEDThe Google Sheets API is off in your Cloud project. The message includes the link to enable it.
SPREADSHEET_NOT_FOUNDWrong ID or URL.
NOT_A_GOOGLE_SHEETThe file is an uploaded .xlsx. Use File → Save as Google Sheets.
TAB_NOT_FOUNDThe tab does not exist and creating tabs is off. The message lists the existing tabs.
CELL_LIMIT_EXCEEDEDThe spreadsheet would pass 10,000,000 cells. Checked before writing; if it happens mid-run, the message tells you where to continue.
QUOTA_EXCEEDED / GOOGLE_UNAVAILABLEStill failing after all retries. Lower the request rate or try again later.
KEY_INVALID / AUTH_KEY_REJECTED / TOKEN_EXPIREDBroken, deleted or expired credentials.
PROTECTED_RANGEThe tab or a range in it is protected.

How much does it cost to export to Google Sheets?

Pay per event, with no subscription:

EventPriceWhen
row-written$0.0005 per row ($0.50 per 1,000)A row was appended or updated, charged after Google confirmed the write
apify-actor-start$0.005 per runAt run start (default 512 MB = one start event)

Free: unchanged rows (upsert), rows skipped for a missing key, duplicate keys in the input, the header row, cleared rows (replace) and dry runs.

ExampleCost
Append 1,000 scraped rows1,000 × $0.0005 + $0.005 = $0.505
Daily upsert of 5,000 products, 400 changed + 100 new500 × $0.0005 + $0.005 = $0.255 per day (about $7.65 per month)
Replace a 200-row dashboard tab every hour200 × $0.0005 + $0.005 = $0.105 per run
Dry run of any size$0.005

Budget-safe: set Max total charge on the run. The Actor never writes more rows than your budget covers. It stops gracefully with stoppedReason: "max-charge-reached" and a complete summary.

Use it from n8n, Make, Zapier or the API

Apify integrations (no code): on your scraper's Integrations tab, add this Actor as a follow-up step and set the input "datasetId": "{{resource.defaultDatasetId}}". After every run, the new results land in your sheet.

n8n: use the Apify node ("Run Actor") or an HTTP Request node:

POST https://api.apify.com/v2/acts/grace_hartwell~google-sheets-export-pro/runs?waitForFinish=300
Authorization: Bearer <your Apify API token>
Content-Type: application/json
{ "items": {{ JSON.stringify($json.items) }}, "spreadsheetId": "<sheet URL>", "sheetName": "Leads",
"mode": "upsert", "keyColumns": ["email"], "serviceAccountKey": "<JSON key>" }

Then read the OUTPUT record of the run's default key-value store for the counts and the sheet URL.

Make: Apify app → Run an Actor → grace_hartwell/google-sheets-export-pro with the same JSON input → Get record OUTPUT.

JavaScript:

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('grace_hartwell/google-sheets-export-pro').call({
datasetId: 'aBcD1234EfGh5678',
spreadsheetId: 'https://docs.google.com/spreadsheets/d/1AbC...xyz/edit',
sheetName: 'Products',
mode: 'upsert',
keyColumns: ['url'],
serviceAccountKey: process.env.GOOGLE_SA_KEY,
});
const summary = await client.keyValueStore(run.defaultKeyValueStoreId).getRecord('OUTPUT');
console.log(summary.value.rowsAppended, summary.value.rowsUpdated, summary.value.sheetUrl);

Combine with deduplication: Merge & Deduplicate Datasets (merge several runs, only new items) → this Actor in upsert mode → one clean, current sheet.

Our test

Tested with automated tests and a local Google Sheets API simulator that injects 429 and 503 errors, missing tabs, permission errors, a disabled API and the cell limit. Example: 50,000 rows were appended in 55 requests. An upsert of 51,000 items (5,000 changed, 1,000 new) then took 32 requests: 1,000 rows appended, 5,000 updated, 45,000 unchanged and free, and no duplicate keys. A run stopped after 2 of 5 batches resumed to exactly 500 rows, with no duplicates and no double charge. Speed on real Google Sheets depends on Google's quotas. Hartwell Toolworks, Oct 2026.

FAQ

Do I need a Google Cloud billing account?

No. The Google Sheets API is free to use within its default quotas. You only need a Google Cloud project with the Sheets API enabled and a service account.

Why a service account and not "Sign in with Google"?

A service account works unattended in schedules and never expires. You decide exactly which spreadsheets it can access by sharing them. An OAuth access token also works for one-off runs.

How does upsert avoid duplicates?

It reads the key column(s) of the existing tab, matches every item by its key (composite keys allowed, optionally case-insensitive) and updates the matching row. New keys are appended. If a key appears several times in the input, only its last occurrence is written.

What happens when the dataset has new fields?

In merge mode, new fields become new columns at the end of the header. Existing columns are never reordered, so your formulas and charts keep working.

Can I export more than 10 million cells?

No. That is Google's hard limit per spreadsheet, and it counts all tabs including empty grid cells. The Actor checks this before writing. Use several spreadsheets, onlyListedColumns, or split the export with datasetOffset/datasetLimit.

Will a failed or aborted run leave half-written data?

Rows that were written stay in the sheet. After a platform migration the same run resumes on its own. If a run fails, the message tells you how to continue: use upsert, which is always safe to repeat, or the exact datasetOffset for append.

Is my key safe?

The key is a secret input field (encrypted at rest by Apify), is never logged and is only sent to Google's OAuth endpoint as a signed token. Use a dedicated service account that has access only to the sheets you share with it.

Limitations

  • One tab per run. To fill several tabs, run the Actor several times.
  • The header is always row 1, and data starts in row 2.
  • Upsert compares values as Google returns them. With USER_ENTERED, values Google converts (dates, percentages) may be rewritten on every run. Use RAW for exact change detection.
  • If the sheet already has duplicate keys, only the first matching row is updated.
  • No cell formatting, colours or formulas, only values.
  • Existing rows are never deleted in append or upsert. Only replace clears old rows.

Other Actors by Hartwell Toolworks

ActorWhat it does
Merge & Deduplicate DatasetsMerge scraper runs, remove duplicates, only new items
HTML to Markdown Converter for LLM & RAGTurn scraped pages into clean Markdown
Broken Link Checker & Redirect Chain Checker404s, redirect chains and loops

Found a bug or an edge case? Open an issue on the Issues tab.