Export to Google Sheets: batched, retried, clear errors avatar

Export to Google Sheets: batched, retried, clear errors

Pricing

$5.00 / 1,000 export completeds

Go to Apify Store
Export to Google Sheets: batched, retried, clear errors

Export to Google Sheets: batched, retried, clear errors

Exports an Apify dataset or a JSON list to a Google Sheets tab, within Google's quotas, with retries and actionable error messages. Authenticates with a service account, so no interactive login is needed.

Pricing

$5.00 / 1,000 export completeds

Rating

0.0

(0)

Developer

Datos Fiables

Datos Fiables

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

20 days ago

Last modified

Categories

Features

Limited permissions

Share

Send an Apify dataset or a JSON list to a Google Sheets tab, without hitting Google's quotas and without an interactive Google login.

  • Batched writes with a minimum gap between requests, to stay under Google's per-minute limit.
  • Automatic retries on 429 and 5xx errors, honouring Retry-After.
  • Service account authentication: works unattended, in schedules, integrations and AI agents.
  • Checks before writing: the tab exists and the sheet stays under Google's 10 million cell limit.
  • Clear errors: every failure returns a stable codigo, a mensaje and a solucion that says how to fix it.
  • Values are written as-is (RAW): 00123 stays 00123, 1-2 is not turned into a date, =SUM() is not executed.

Pricing

$0.005 per completed export, plus a tiny amount of platform compute (default memory 512 MB). Runs that fail are not charged.

How to use it

  1. Create a service account key (free, one time):
    • In Google Cloud Console create a project and enable the Google Sheets API.
    • Go to IAM & Admin → Service accounts → Create service account, then Keys → Add key → JSON. A .json file is downloaded.
  2. Share your spreadsheet as Editor with the client_email from that file (it ends in iam.gserviceaccount.com).
  3. Run the Actor with the spreadsheet URL, the contents of the JSON key and either a datasetId or data.

Tip: to export the results of another Actor automatically, add this Actor as an integration of that Actor and pass its default dataset ID.

Input

FieldTypeDefaultDescription
spreadsheetIdstring—Spreadsheet URL or ID. Required.
serviceAccountJsonstring (secret)—Full JSON key of the service account. Required.
datasetIdstring—Apify dataset to export. Use this or data.
dataarray—List of JSON objects. Use this or datasetId.
sheetNamestringfirst tabExact tab name.
modeappend | replaceappendAdd rows at the end, or clear the tab first.
writeHeadersbooleantrueWrite column names if the tab is empty.
maxRowsinteger50000Maximum rows to export (up to 1,000,000).

Example:

{
"spreadsheetId": "https://docs.google.com/spreadsheets/d/YOUR_ID/edit",
"serviceAccountJson": "{ \"type\": \"service_account\", ... }",
"datasetId": "YOUR_DATASET_ID",
"sheetName": "Data",
"mode": "append"
}

Output

One item in the default dataset per run.

Success:

{
"estado": "ok",
"hoja": "My spreadsheet",
"pestana": "Data",
"modo": "append",
"filasEscritas": 1200,
"cabecerasEscritas": true,
"columnas": ["name", "age", "city"],
"lotes": 1,
"avisos": [],
"peticionesAGoogle": 3,
"reintentos": 0,
"fuente": "https://docs.google.com/spreadsheets/d/YOUR_ID/edit#gid=0",
"actualizado": "2026-11-02T10:00:00.000Z"
}

Error (the run is marked as failed and is not charged):

{
"estado": "error",
"codigo": "SIN_PERMISOS",
"mensaje": "Google denegó el acceso a la hoja (403).",
"solucion": "Abre la hoja, pulsa Compartir y añade el email de la cuenta de servicio (campo client_email) como Editor. ...",
"actualizado": "2026-11-02T10:00:00.000Z",
"fuente": "https://developers.google.com/workspace/sheets/api/limits"
}

Field names are in Spanish and stable, so agents and integrations can rely on them. mensaje and solucion are currently in Spanish; the codigo table below explains each one in English.

Error codes

codigoMeaning
ENTRADA_INVALIDAMissing or wrong input (e.g. both datasetId and data).
CREDENCIALES_INVALIDASThe service account JSON is malformed.
AUTENTICACION_FALLIDAGoogle rejected the key (deleted key or Sheets API not enabled).
SIN_PERMISOSThe spreadsheet is not shared with the service account.
HOJA_NO_ENCONTRADAWrong spreadsheet URL or ID.
PESTANA_NO_ENCONTRADANo tab with that name.
DATASET_NO_ENCONTRADONo dataset with that ID or name in your account.
SIN_DATOSNothing to export.
LIMITE_CELDASThe export would exceed Google's 10M cell limit.
CUOTA_SUPERADAGoogle's quota was still exceeded after retries.
ERROR_GOOGLEOther error returned by Google.
ERROR_INESPERADOAnything else; retry, and report it with the run ID if it persists.

Limitations

  • Does not create spreadsheets or tabs, and does not format cells.
  • Rows are loaded into memory: up to maxRows (50,000 by default).
  • replace clears the tab before writing. If a later batch fails, the tab is left partially written (the error says so and how many rows were written).
  • An interrupted export is not resumed.

Privacy

Your data and key go only from Apify to Google's official Sheets API. The key is a secret input: it is stored encrypted and never logged.

Questions or bugs

Open an issue in the Issues tab of this Actor. Include the run ID.