Google Sheets Export & Sync: append, upsert, dedupe
Pricing
from $0.05 / 1,000 row writtens
Google Sheets Export & Sync: append, upsert, dedupe
Send any Apify dataset to a Google Sheet with your own service account (your own quota). Append, replace, upsert by key or add only new rows, with dedupe, column selection and renaming, nested JSON flattening, batching and automatic retries. Works as an integration after any Actor run.
Pricing
from $0.05 / 1,000 row writtens
Rating
0.0
(0)
Developer
Arpit Goriya
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
3 hours ago
Last modified
Categories
Features
Share
Send any Apify dataset to a Google Sheet, with your own Google credentials, for $0.05 per 1,000 rows.
Run it after any scraper and your results land in a Google Sheet, laid out the way you want:
- 4 write modes: append, replace, upsert by key (update rows that already exist, add the others) and append new only (add only rows whose key isn't in the sheet yet).
- Your own service account, your own quota. Your exports don't share a Google quota with thousands of other users, so you don't get random "quota exceeded" failures.
- Built for big and scheduled exports: rows are written in large batches; Google rate limits (HTTP 429) and server errors are retried automatically with exponential backoff.
- Clean columns: nested JSON is flattened (
price.amount), lists becomea, b, c. Pick, order, rename and exclude columns. New fields are added as new columns on the right. - Remove duplicates from the data before writing.
- Works as an integration: add it to any Actor or task and every finished run is exported automatically.
- Clear errors that tell you what to fix, e.g. "Open the sheet → Share → add exporter@my-project.iam.gserviceaccount.com as Editor".
- Free dry run: without a key, or with Dry run on, it shows exactly what would be written and charges nothing.
It uses only the official Google Sheets API, with credentials you control. Your data goes straight from your Apify dataset to your sheet.
Use cases
- Scraper → spreadsheet pipelines. Schedule a scraper daily and keep one Google Sheet up to date for your team or client, without duplicates.
- Price and stock monitoring. Upsert by product URL: prices update in place, new products are added, your own notes in other columns stay.
- Lead lists. Append only new leads (by email, domain or profile URL) to a sheet your sales team already works in.
- Job, real-estate, review and news feeds. "Append new only" turns any scraper into a growing, deduplicated feed.
- Reporting. Replace a tab with the latest numbers every morning and point your charts or Looker Studio at it.
- No-code automations. Many Zapier/Make/n8n flows start from a Google Sheet. Fill it from Apify with one integration.
Setup: create a service account and share your sheet (5 minutes, once)
You need a Google Cloud service account: a robot Google account that writes to the sheets you share with it. It's free and doesn't need a credit card.
- Create a project. Open console.cloud.google.com/projectcreate, enter a name (e.g.
apify-sheets) and click Create. Make sure the new project is selected at the top of the page. - Enable the Google Sheets API. Open the Sheets API page and click Enable.
- Create the service account. Go to IAM & Admin → Service accounts (direct link) → Create service account. Give it a name such as
apify-exportand click Done. It needs no roles. - Create a key. Click the new service account → Keys tab → Add key → Create new key → JSON → Create. A
.jsonfile is downloaded. Keep it private: it is the password of this robot account.- If your organization blocks key creation (policy
iam.disableServiceAccountKeyCreation), ask your Google Workspace admin, or use a personal Google account for this project.
- If your organization blocks key creation (policy
- Share your sheet. Copy the service account's email (it looks like
apify-export@apify-sheets.iam.gserviceaccount.com). Open your Google Sheet → Share → paste the email → role Editor → untick Notify people → Share. - Paste the key into the Actor. Open the downloaded JSON file in a text editor, copy everything and paste it into Service account key (JSON). Apify stores this field encrypted, and it is never written to logs or outputs.
Tip: save your settings as an Apify task (Actor page → Save as a new task), so you paste the key only once.
The service account can only open sheets you share with it. To stop access, remove it from the sheet's sharing or delete the key in Google Cloud.
How to use it
Export one dataset
- Click Try for free.
- Google Sheet URL or ID: paste the sheet's URL from your browser. The tab in the URL (
#gid=…) is used, or set Sheet (tab) name (it's created if it doesn't exist). - Service account key (JSON): paste the key (see the setup guide above).
- Dataset: pick the dataset, or enter a Run ID to export that run's results.
- Choose a Mode and click Start.
Export every run of another Actor automatically (integration)
- Open the Actor or task whose results you want in the sheet (for example your scraper) → Integrations tab.
- Choose Connect Actor or task → search for Google Sheets Export & Sync.
- Set the sheet URL, key, mode and columns, and leave Dataset empty. Each time that Actor's run succeeds, its dataset is exported. The triggering run's dataset ID is passed automatically.
Easiest: first save this Actor's settings as a task, then connect that task.
From the API, Make, Zapier or n8n
Call this Actor with datasetId (or runId) in the input, for example in a "run Actor" step right after your scraper step.
{"spreadsheet": "https://docs.google.com/spreadsheets/d/1AbC…/edit#gid=0","serviceAccountKey": "{ \"type\": \"service_account\", … }","datasetId": "WkzbQMuFYuamGv3YF","sheetName": "Products","mode": "upsert","keyColumns": ["url"],"columns": ["url", "title", "price.amount", "price.currency", "inStock"],"columnNames": { "price.amount": "Price", "price.currency": "Currency" }}
Write modes
| Mode | What it does | Typical use |
|---|---|---|
| Append (default) | Adds all rows below the existing ones. | Logs, history, one-off exports |
| Replace | Overwrites the tab with this data (header + rows); old rows and columns beyond the new data are cleared. | "Latest snapshot" tabs, dashboards |
| Upsert | Finds rows with the same key columns and updates them; adds rows whose key is new. Columns the data doesn't have (e.g. your own notes) are kept. Unchanged rows aren't rewritten and are free. | Price/stock tracking, CRM-like lists |
| Append new only | Adds only rows whose key isn't in the sheet yet; existing rows are never touched. | Lead lists, job/news feeds, monitoring |
Header row: row 1 holds the column names. In an empty tab it's created for you. In a tab that already has a header, data is matched to columns by name (order doesn't matter), and new fields are added as new columns on the right (turn off Add new columns to skip them instead).
Keys can be one column (url) or several (["sku", "store"]). You can use the field name or the renamed header. Key matching ignores leading and trailing spaces.
Input options
| Option | Default | What it does |
|---|---|---|
spreadsheet | — | Sheet URL or ID. |
serviceAccountKey | — | Service account JSON key (secret). Empty = dry run. |
sheetName | tab from URL, else first tab | Tab to write to; created if missing. |
datasetId | — | Dataset to export. Empty when used as an integration. |
runId | — | Export this run's default dataset instead. |
offset, maxItems | 0, 0 (all) | Read only part of the dataset. |
mode | append | append, replace, upsert, appendNew. |
keyColumns | [] | Key columns for upsert / append new only / dedupe. |
dedupe | false | Remove repeated rows from the data (by key columns, or identical rows). |
columns | all | Fields to export, in this order. price includes price.amount and price.currency. |
excludeColumns | [] | Fields to leave out. |
columnNames | {} | Rename columns: {"price.amount": "Price"}. |
addNewColumns | true | Add new fields as columns on the right. |
arrayMode | join | Lists: join (a, b, c), json (["a","b","c"]) or expand (tags.0, tags.1…). |
valueInputOption | RAW | RAW writes values exactly. USER_ENTERED lets Sheets parse dates and formulas, as if typed. |
dryRun | false | Check everything and report, without writing or charging. |
Values keep their type: numbers stay numbers, true/false stay booleans, everything else is text. With the default Raw setting, scraped text that starts with = is stored as text and can never run as a formula.
Output
The sheet is the main output. The run also saves a short summary (dataset + RUN_SUMMARY record):
{"dryRun": false,"mode": "upsert","spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1AbC…/edit","spreadsheetTitle": "Competitor prices","sheetName": "Products","datasetId": "WkzbQMuFYuamGv3YF","itemsRead": 1250,"columns": 6,"header": ["url", "title", "Price", "Currency", "inStock", "my notes"],"rowsAppended": 40,"rowsUpdated": 212,"rowsUnchanged": 998,"rowsSkippedExisting": 0,"duplicatesRemoved": 0,"rowsWritten": 252,"apiRequests": 6,"retries": 0,"durationSecs": 4.1}
A dry run also saves a PREVIEW record with the header and the first 20 rows exactly as they would be written.
How much does it cost?
You pay only when rows are actually written. No subscription, no start fee for runs that write nothing.
| Event | Price | |
|---|---|---|
| Row written (appended, replaced or updated) | $0.00005 | $0.05 per 1,000 rows |
| Sheet sync (once per run that writes at least one row) | $0.005 | |
| Dry runs, unchanged rows, duplicates, rows already in the sheet, failed runs | free |
Examples:
| Job | Cost |
|---|---|
| Export a 1,000-row scrape once | $0.055 |
| Daily upsert of 2,000 products where ~150 change | ~$0.0125 a day, ~$0.38 a month |
| Hourly "append new only" lead feed, ~20 new leads per run | ~$0.006 per run |
| Replace a 50,000-row tab | $2.505 |
Platform usage is included. Google doesn't charge for the Sheets API. Set a maximum cost per run: if a run would cost more, it stops before writing anything and tells you, so you never get a half-written sheet because of the limit.
How it compares
| This Actor | Typical Sheets export Actor | Apify's built-in Google Drive integration | |
|---|---|---|---|
| Google quota | Your own (service account) | Often shared by all users → "quota exceeded" | Your account |
| Upsert by key / append only new | ✅ | Partly | ❌ (uploads a file) |
| Dedupe, column pick / rename / order | ✅ | Partly | ❌ |
| Backoff on 429 / 5xx | ✅ automatic | Varies | — |
| Writes into an existing tab, keeps your other columns | ✅ | Varies | ❌ |
| Free dry run with preview | ✅ | ❌ | — |
Limits and tips
- Google Sheets limits: 10 million cells per spreadsheet and 50,000 characters per cell. The Actor checks the cell limit before writing and stops with a clear message; longer cells are shortened (the summary counts them). For big data, export only the columns you need, or use a new tab or spreadsheet per month.
- Speed: up to 10,000 rows (about 2 MB) per API request, so a 50,000-row export needs only about 5–10 write requests. Upsert and append-new-only read the whole tab first, so very large tabs (over 1 million cells) take longer: give the run more memory (1–2 GB).
- Google quota: your project allows 60 write requests per minute per service account by default. Each run uses only a few requests, so you'd only hit it with many parallel runs. Then the Actor waits and retries.
- Memory: the default 512 MB is enough for about a million cells.
- Don't edit the tab while a big replace or upsert runs. Rows you insert or sort during the run can shift the positions being written.
- Free dry runs read at most the first 1,000 items.
Use it from AI agents (MCP)
This Actor is available as a tool through the Apify MCP server, so Claude, ChatGPT, Cursor, VS Code, n8n and any other MCP client can call it directly. The input schema becomes the tool's parameters automatically.
Load only this Actor as a tool (remote server, sign in with Apify on first connect):
{"mcpServers": {"google-sheets-export": {"url": "https://mcp.apify.com?tools=arpitgoriya/google-sheets-export"}}}
Or run the MCP server locally (stdio):
$npx -y @apify/actors-mcp-server --tools arpitgoriya/google-sheets-export
Then an agent can finish a scraping job by writing the results to your sheet, for example: "Scrape these 20 job boards, then upsert the results into my 'Jobs' sheet by URL." Save your key in an Apify task so the agent doesn't need to see it.
FAQ
Why a service account instead of "Sign in with Google"? A service account is a key that you create and control, and it works for scheduled runs without anyone being logged in. You decide exactly which sheets it can open by sharing them with it. It also means your own Google quota instead of one shared by every user of the Actor.
Is my key safe? The key field is a secret input: Apify encrypts it, and it's hidden in the Console, logs and the run's input. The Actor only uses it to get a short-lived Google token with the Sheets scope. The service account can't see anything you haven't shared with it.
The run failed with "can't open the spreadsheet". Share the sheet with the service account's email (shown in the error) as Editor. Also check the URL: it must be a Google Sheets file, not an uploaded .xlsx file. Open it and use File → Save as Google Sheets first.
"The Google Sheets API is not enabled in your Google Cloud project". Open the link in the error, click Enable, wait a minute and run again.
Can I use "Anyone with the link → Editor" instead of adding the email? It works (tested), but then anyone who has the link can edit your sheet. Adding the service account's email as Editor is safer and is what we recommend.
Can I write to a sheet in a shared drive? Yes. Share the sheet (or the shared drive) with the service account as Editor.
My dates show up as text. With the default Raw setting, values are stored exactly as they appear in the data. Choose Cell values: As if typed to let Google parse dates and numbers.
Can I export to CSV or Excel instead? Apify's dataset already exports CSV, Excel, JSON and XML for free: open the dataset and click Export. This Actor is for when you want the data inside Google Sheets.
Does it read my other sheets or files? No. It reads only the tab it writes to (header, plus the rows for upsert / append new only).
Other tools from us
- Website Screenshot & PDF Generator: full-page screenshots and PDFs of any web page.
- Website Tech Stack Lookup & Domain Intel: technologies, DNS, email provider and hosting for any domain.
- Document to Markdown & JSON for AI/RAG: PDF, DOCX, PPTX, XLSX and HTML to clean Markdown with RAG-ready chunks.
- Company Jobs Feed: live jobs from Greenhouse, Lever, Ashby, Workable and more, with new-jobs-only monitoring.
Feedback and support
Something didn't export the way you expected, or need a feature (CSV/XLSX file output, Excel Online, formatting)? Open an issue on the Issues tab. We read every issue and reply as quickly as we can.
Google Sheets is a trademark of Google LLC. This Actor is not affiliated with or endorsed by Google.