Google Sheets Import & Export – Datasets to Sheets and Back
Pricing
from $0.01 / 1,000 rows
Google Sheets Import & Export – Datasets to Sheets and Back
Writes Apify dataset rows to a Google Sheet (append, replace or upsert by key) and reads sheet tabs back as dataset rows. Share the sheet with our service account and add a tab naming your Apify account; no Google login.
Pricing
from $0.01 / 1,000 rows
Rating
0.0
(0)
Developer
Extractly Space
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a day ago
Last modified
Categories
Features
Share
This Actor writes the rows of an Apify dataset (or rows you send) to a tab of a Google Sheet, and reads a tab back as dataset rows. Export appends, replaces or upserts by a key column; import returns one row per sheet row. To use a sheet, share it with sheets-sync@monday-brief-507421.iam.gserviceaccount.com (Editor to export, Viewer to import) and add a tab named apify-<your Apify user id>. No Google login and no Google credentials from you.
Set up a sheet (once per sheet)
- Share the sheet with
sheets-sync@monday-brief-507421.iam.gserviceaccount.com: Editor to export, Viewer to import. - Add a tab named
apify-<your Apify user id>, for exampleapify-AbC123xYz45678901(a user id is 17 letters and digits). It can be empty and hidden. Your user id is in Apify Console under Settings. If you skip this step, the first run answersnot_sharedand names the exact tab to add.
A teammate on another Apify account adds a tab with their own id. A sheet that is public ("Anyone with the link" can view) needs neither step to import: pass the URL of the tab (with #gid=) and leave sheetName empty.
Use this to
- Send scraper results to a sheet: "After every run of my scraper, append the new rows to the tab
Leads." - Keep a sheet in sync: "Update rows by
id, add the new ones" (writeMode: upsert,keyColumn: id). - Read a sheet in a workflow or from an AI agent: "Read the tab
Targetsand use the rows as input for the next Actor."
Export from another Actor in three clicks
- Open the Actor whose results you want in the sheet, go to Integrations and choose Google Sheets Import & Export (an Actor-to-Actor integration), trigger "run succeeded".
- Paste this as the integration's input, with your sheet's URL:
{"mode": "export", "spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1XIrxiVSWCaeSZOSyORrM8cbRkDEIjZmxvUjGlfz3VQA/edit", "datasetId": "{{resource.defaultDatasetId}}"}
- Save. Every finished run now sends its dataset to the sheet.
Console integrations fill in {{resource.defaultDatasetId}} for you. If you create the integration through the webhooks API, set shouldInterpolateStrings: true.
Pricing
You pay per event:
row: $0.00002 for each row written, updated or read. That is $0.20 per 10,000 rows. Store discounts apply to the price: Bronze −10%, Silver −20%, Gold, Platinum and Diamond −30%.
Examples: exporting 500 rows costs $0.01. Importing 10,000 rows costs $0.20. A nightly upsert of 2,000 rows costs $0.04 a run.
Rows skipped because their key is already in the sheet, summary rows and status rows are never charged. The run stops when it reaches your spending limit.
Input
- mode (required):
exportwrites rows to the sheet;importreads a tab and returns its rows. - spreadsheetUrl (required): the sheet's URL or id.
- sheetName: the tab to write or read. Empty: the tab of the URL's
#gid=, else the first tab. Export creates a missing tab. A name of the formapify-<Apify user id>is refused; other names that start withapify-are fine. - datasetId (export): the dataset to export. Use it or
rows, not both. - rows (export): up to 1,000 flat objects to export directly, instead of a dataset. Meant for AI agents and MCP calls.
- writeMode (export):
append(default) adds rows below the last row and, withkeyColumn, skips keys already in the sheet;replaceclears the tab first and writes everything;upsertupdates the rows whose key matches and appends the rest. - keyColumn (export): the column that identifies a row, for example
id. Required forupsert. - columns (export): the columns to write, in order. Empty: all keys, in first-seen order.
- maxRows: the most rows to write or read in this run, 1 to 100,000 (default 10,000). Each row is charged.
Output
Export pushes one free summary row: recordType, spreadsheetId, sheetName, sheetUrl (a link to the tab), rowsWritten, rowsUpdated, rowsSkipped, columns (the header after the run, joined with commas) and mode. A run that wrote nothing returns a status row instead.
Import pushes one row per sheet row, with recordType: "row", _rowNumber (the sheet row; row 1 is the header), _sheetName, and one key per header cell. Values come back as the sheet shows them, as strings ("1,200" stays "1,200"); empty cells are empty strings. Completely empty rows are skipped. An empty or repeated header gets the name column_3 or name_2.
How rows are written
- Flattening: nested values become columns the way Apify's CSV export does:
address.cityfor an object,tags/0for a list item. - Raw values: cells are written as-is. A value starting with
=stays text and is never run as a formula. - Header: a new tab gets the header from the first rows. New columns are added to the right of existing ones. Existing columns are never reordered or removed.
- Upsert blanks the cells of columns an item lacks, for the matched row.
- Replace clears the tab first, then writes. It changes nothing unless the spending limit pays for every row: then it returns only
limit_reached, and the tab stays as it was. If Google's quota stops the run right after the clearing, the tab is left empty, and the status row says so. - Append after a timeout: Google may have accepted a write the Actor never heard back about. The Actor never repeats such an append itself (only a request Google refused with "too many requests" is sent again), but a run you repeat can write rows twice. Set
keyColumnand the rows already in the sheet are skipped.
Limits
- A spreadsheet holds at most 10 million cells. An export that would go over it writes nothing and returns
too_large. - Google allows 60 write requests and 60 read requests a minute for the service account, shared by all users of this Actor. The Actor backs off and retries: a request Google turns away as too many is sent again up to five times (after 0.5, 1, 2, 4 and 8 seconds). If Google still does not answer, it returns
partialand what was written stays in the sheet. Run again a minute later. - Rows are written in requests of at most 5,000 rows and about 4 MB, and read in windows of 1,000 rows.
- 1 to 100,000 rows per run (
maxRows);rowsaccepts up to 1,000.
What you get when something is wrong
An input the form itself rejects is refused before the run starts. Otherwise the run succeeds and returns a status row (recordType: "status", with status, message and subject), never an empty dataset. The run fails only when Google or Apify could not be reached and nothing was delivered. The status is one of:
invalid_input: the URL is not a Google Sheets URL or id; export without exactly one ofdatasetIdandrows; more than 1,000rows;upsertwithoutkeyColumn(keyColumn is required when writeMode is "upsert". Example: {"writeMode": "upsert", "keyColumn": "id"}); akeyColumnthat is not in the written columns or the sheet's header; asheetNameof the formapify-<Apify user id>; a URL that points at such a tab; a request Google refuses before any row moved (status 400):Google Sheets refused the request (status 400): the tab may not exist, a range may lie outside the sheet, or the request may be too large (…). No row was written.(on import:Nothing was read.).not_shared:To let this Apify account use the sheet, share it with <email> as Editor (export) or Viewer (import), add a tab named apify-<your id> (you can hide it), and run again.Also, after a refused write:Share the sheet with <email> as Editor, then run again.not_found: the spreadsheet, the tab or the dataset does not exist (or this run may not read the dataset). The message lists the tabs of the sheet.no_results: the dataset has no items, the items have no fields, or the imported tab has no data rows below the header.too_large:This export would grow the spreadsheet to N cells; Google allows 10,000,000 per spreadsheet. Write fewer rows or columns, …partial:Google Sheets did not answer (quota or time ran out); no row was written. Run again in a minute.or… after the tab was cleared; no row was written.orGoogle Sheets stopped answering … after N of M rows were written or updated; the rows already written stay in the sheet.On import:… after N rows were read; those are returned.When Google refused a request (status 400) after some rows:Google Sheets refused the request (status 400): … N of M rows were written or updated before it; those stay in the sheet.(on import:N rows were read before it; those are returned.). A refusal is not an outage: the run succeeds, and running it again unchanged gives the same answer. AlsoDataset … could not be read right now (Apify did not answer) …and, for a public link that did not answer,Google did not answer on the sheet's public link (busy or timed out) ….limit_reached:Stopped: the spending limit for this run was reached. N of M rows were written or updated and K left out. Raise the limit and run again.Withreplace:The spending limit pays for N of M rows, so the tab was not changed. Raise the limit or use append.On import:Returned N of M rows.
What it never does
It never reads or writes anything outside the spreadsheet you share, never stores your sheet's content or your Apify token, and never asks for a Google login. It does not read other tabs than the one you name.
FAQ
Why share with an email and not sign in? Signing in would hand this Actor your Google account. Sharing one sheet with a service account gives access to that sheet only, and you can remove it at any time in the sheet's sharing settings. The Actor holds no login of yours and stores nothing about you.
Why the extra tab? All users share one service account, so the sheet's id alone must not open a sheet for anyone who knows it. The tab named apify-<your Apify user id> shows that someone who can edit the sheet authorised your Apify account: only editors can add a tab. The Actor stores nothing for this; it looks for the tab on every run. The id is not a secret.
Where do I find my Apify user id? In Apify Console under Settings. The first run without the tab also tells you the exact tab name.
Can I import a public sheet without sharing? Yes. Pass the URL of the tab (with #gid=) and leave sheetName empty. The sheet must be viewable by anyone with the link.
Do numbers and dates keep their format on import? Values come back as the sheet shows them, as strings. Convert them in your next step.
Can it write to the same tab as another run at the same time? Avoid it. Two runs appending at once can interleave rows; use keyColumn to keep them unique.
This Actor reports usage statistics to its developer to keep it reliable: the Actor's name and build number, the time of the run, the run's outcome, row counts, events charged, an estimate of the revenue from those events, an estimate of what paid data sources cost for the run (always zero for this Actor), duration, a short error category when a run fails, partly fails or meets upstream data in an unexpected shape, how the run was started, whether the account is on a paid plan, and a one-way hash of the Apify user ID. It never reports your inputs, your sheet's content or the data returned.