Google Sheets Import & Export (append, upsert, dedupe)
Pricing
from $0.05 / 1,000 row processeds
Google Sheets Import & Export (append, upsert, dedupe)
Export any Apify dataset to Google Sheets or read a sheet into a dataset. Append without overwriting, upsert by key, skip or remove duplicates, clear error messages and retries on Google limits. Uses your own service account.
Pricing
from $0.05 / 1,000 row processeds
Rating
0.0
(0)
Developer
Solid Actors
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
11 days ago
Last modified
Categories
Features
Share
Send any Apify dataset to a Google Sheet, or read a Google Sheet into a dataset. Built to be boring and reliable: append really appends, upsert updates by key, duplicates are skipped or removed, and when something is wrong you get a sentence that tells you what to fix.
What it does
| Mode | What happens |
|---|---|
append | Adds the new rows under the last row of the tab. Never overwrites. New columns are added to the header on the right. Optional: skip rows whose key is already in the sheet. |
replace | Replaces the content of the tab with the new data. The new data is written first and the old leftovers are cleared after, so the tab is never empty if a run stops midway. |
upsert | Rows whose key (for example url or id) already exist are updated in place; the rest are added. Columns you do not send are kept. |
dedupe | Removes duplicate rows already in the sheet, by key columns or by the whole row. |
read | Copies the tab into the dataset of the run (first row = field names). Public sheets work without any credentials. |
Typical use: run it after a scraper (Integrations, "Run Actor" after success) with datasetId = {{resource.defaultDatasetId}}, so every scrape lands in the same sheet without duplicates.
Why this one
- Append is a real append. Rows are written to an exact row range after the last used row, not through Google's "table detection", which is what makes other tools overwrite or misplace data when a sheet has gaps.
- Plain-language errors. "Share the sheet with
my-bot@project.iam.gserviceaccount.comas Editor", "Turn on the Google Sheets API here: (link)", "The tab names in this spreadsheet are: ...". No stack traces. - Retries. Google rate limits (HTTP 429) and server errors are retried with backoff, up to 7 times per request.
- Cell limit guard. Google allows 10 million cells per spreadsheet and counts empty cells too. The Actor shrinks the tab to the data after writing and stops before a write that would go over the limit, instead of failing halfway.
- Safe values by default. Text that starts with
=stays text (no formula injection from scraped data). Turn onparseValuesif you want Google to parse formulas and dates. - Nested data flattened like the Apify CSV export (
address/city,tags/0), or kept as JSON text. - Dry run checks access, keys and size without writing.
- Your own credentials. Nothing to authorize with a third party: you use a Google service account you control (or your own OAuth client).
Set up Google access (5 minutes, free, once)
- Open https://console.cloud.google.com/ and create a project (or use one you have).
- Turn on the Google Sheets API: https://console.cloud.google.com/apis/library/sheets.googleapis.com, click Enable.
- Go to IAM and admin, Service accounts, Create service account. Any name. Skip the optional steps.
- Open the new service account, tab Keys, Add key, Create new key, JSON. A
.jsonfile downloads. - Paste the whole content of that file into the input field Service account key (JSON). Apify stores it encrypted.
- Open your spreadsheet, click Share, add the service account e-mail (it ends in
iam.gserviceaccount.com) as Editor. Untick "Notify people".
Reading a sheet that is shared as "Anyone with the link can view" needs no credentials at all.
Prefer OAuth? Fill oauthClientId, oauthClientSecret and oauthRefreshToken from your own Google Cloud OAuth client (scope https://www.googleapis.com/auth/spreadsheets).
Input example
{"mode": "upsert","spreadsheetId": "https://docs.google.com/spreadsheets/d/1AbC.../edit","sheetName": "Leads","datasetId": "{{resource.defaultDatasetId}}","keyColumns": ["url"],"columnsOrder": ["url", "name", "email"],"serviceAccountJson": "{ \"type\": \"service_account\", ... }"}
Other modes: "mode": "append" with "skipDuplicates": true, "mode": "replace", "mode": "dedupe" with "keyColumns": ["email"], "mode": "read".
Output example
Write modes push one summary row to the dataset (also saved as SUMMARY in the key-value store):
{"status": "ok","mode": "upsert","spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1AbC.../edit","sheetName": "Leads","rowsInput": 5000,"rowsWritten": 1200,"rowsUpdated": 3800,"rowsSkippedDuplicate": 0,"rowsRemovedDuplicate": 0,"newSheetCreated": false,"newColumnsAdded": ["phone"],"columns": 14,"cellsUsedAfter": 98014,"warnings": [],"error": null,"durationSec": 9.4}
Read mode pushes one item per sheet row: {"Student Name": "Alexandra", "Gender": "Female", "Home State": "CA", ...}.
Pricing
Pay per event: a small fee per run plus $0.05 per 1,000 rows written, updated or read (rows skipped as duplicates are not charged). Example: exporting a 5,000-row dataset costs about $0.25. Set a maximum cost per run in the run options if you want a hard cap; the Actor stops cleanly when it is reached.
Limits
- Google limits: 10 million cells per spreadsheet, 50,000 characters per cell (longer values are cut and counted in
cellsTruncated), and per-minute request quotas on your Google project (handled by retries). upsert,dedupeandappendwithskipDuplicatesread the whole tab first. Very large tabs (millions of cells) need more memory: use 1 GB or more.- A service account cannot create new spreadsheets in your Drive; create the spreadsheet yourself and share it. New tabs are created automatically.
- Reading a public sheet by tab name without credentials uses Google's CSV endpoint, which can blank cells in columns that mix numbers and text. Use credentials or the tab's
#gid=URL for exact values.
Questions and issues
Open an issue on the Actor page. Include the run ID; the summary already says what went wrong in most cases.