Google Sheets Export: Append, Replace & Upsert (No OAuth) avatar

Google Sheets Export: Append, Replace & Upsert (No OAuth)

Pricing

from $0.16 / 1,000 row written or read (after 1,000 free)s

Go to Apify Store
Google Sheets Export: Append, Replace & Upsert (No OAuth)

Google Sheets Export: Append, Replace & Upsert (No OAuth)

Write an Apify dataset (or JSON) to a Google Sheet using a service account you share the sheet with. Append really appends, replace replaces, upsert matches a key column. No OAuth popup and no tokens that expire.

Pricing

from $0.16 / 1,000 row written or read (after 1,000 free)s

Rating

0.0

(0)

Developer

Southern Data

Southern Data

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

14 hours ago

Last modified

Features

Limited permissions

Share

Write an Apify dataset (or a JSON list) to a Google Sheet using a service account you share the sheet with. There is no OAuth consent screen and no refresh token that expires after six unused months.

  • append adds rows after the existing data — it does not overwrite what is already there.
  • replace clears the tab and writes the new header + rows.
  • upsert updates rows that match a key column and appends the rest.
  • read copies the tab back into this Actor’s dataset. Public/published sheets can be read without a key.

Who it's for: anyone who scrapes with Apify and wants the results in a Google Sheet that keeps working, without the OAuth connection that can break, and who needs rows appended or updated rather than the whole sheet overwritten.

Use with AI agents (Apify MCP)

Agents on the Apify MCP server discover Store Actors with search-actors (title, name, description, username and this README) and then call fetch-actor-details for the input schema, output/dataset schema and pricing.

  • Actor name: southern-data/google-sheets-export
  • Use it when: you need to write an Apify dataset (or JSON) to a Google Sheet, or read a sheet back, using a Google service account you share the sheet with. No OAuth popup and no tokens that expire. append really appends; replace replaces; upsert matches a key column.
  • Main inputs: spreadsheetUrl, mode (append, replace, upsert or read), a service account JSON (secret), and datasetId / runId / items / itemsUrl for writes.
  • Output: write modes store a RUN_SUMMARY in the key-value store (rows written, charges). Read mode writes one dataset row per sheet row. If required input is missing, the Actor writes one explanatory dataset row and charges nothing, so the run is not left empty.

Limits (read these first)

  1. You must share the spreadsheet with the service account email as Editor (except public mode=read). If you skip that step, the run ends with a plain-English error naming the email to share with. Nothing is charged. The default input reads Google's public sample Class Data sheet (mode=read) and needs no key. If you try a write mode without a key, the run succeeds, nothing is charged, and one dataset row explains what to do next.
  2. No OAuth. This Actor does not open a Google login popup and does not use your own Google user. That is intentional: the official Apify Google Sheets integration uses OAuth and is a common source of “can’t connect” failures.
  3. Values are written as raw text/numbers. Cells that start with =, +, -, @ or a tab are prefixed with a quote so scraped text cannot run =IMPORTRANGE or similar in your sheet.
  4. First 1,000 rows of each run are free. After that you pay a small start fee plus a per-row fee. A typical “export this Actor’s dataset” job of a few hundred rows costs $0.
  5. Maximum 50,000 rows per run (default cap 20,000). Google’s own spreadsheet cell limit still applies.
  6. Append uses the headers already in the sheet. Extra fields on new items are ignored unless you replace the tab or start from an empty sheet (which writes headers from the data).
  7. Creating a service account is a one-time Google Cloud step (about five minutes). See “Set up the service account” below.

Quick start

Click Try for free to read Google's public sample Class Data sheet. No service account is needed for that read.

To write to your own sheet:

  1. Create a Google Cloud service account, enable the Google Sheets API, and download a JSON key (steps below).
  2. Share your spreadsheet with the client_email inside that JSON as Editor. You can uncheck “Notify people”.
  3. Run:
{
"spreadsheetUrl": "https://docs.google.com/spreadsheets/d/your-spreadsheet-id/edit",
"mode": "append",
"datasetId": "your-apify-dataset-id",
"serviceAccountJson": "{ ... paste the JSON key ... }"
}

Replace the whole tab:

{
"spreadsheetUrl": "https://docs.google.com/spreadsheets/d/your-spreadsheet-id/edit",
"sheetName": "Leads",
"mode": "replace",
"datasetId": "your-apify-dataset-id",
"serviceAccountJson": "{ ... }"
}

Update existing rows by email and append new ones:

{
"spreadsheetUrl": "https://docs.google.com/spreadsheets/d/your-spreadsheet-id/edit",
"mode": "upsert",
"keyColumn": "email",
"datasetId": "your-apify-dataset-id",
"serviceAccountJson": "{ ... }"
}

Set up the service account

  1. Open Google Cloud Console, create or pick a project.
  2. APIs & Services → Enable APIs → enable Google Sheets API.
  3. IAM & Admin → Service accounts → Create. Download a JSON key.
  4. Open the JSON and copy client_email (it looks like sheets@your-project.iam.gserviceaccount.com).
  5. In Google Sheets, Share the spreadsheet with that email as Editor.

Store the JSON key in the Actor input as a secret, or as an Actor secret named GOOGLE_SERVICE_ACCOUNT_JSON if you run this yourself. Do not paste the key into a public README or a shared screenshot.

Chaining after another Actor

After any southern-data (or other) Actor run, pick its default dataset in the Dataset field (or pass datasetId / resource.defaultDatasetId). Selecting the dataset — rather than only pasting an unrelated ID into a generic text box — is what lets this Actor read it under Apify’s limited-permission model.

Pricing (pay per event)

EventPriceWhen
(first 1,000 rows)$0Every run’s first 1,000 rows written or read are free, and there is no start fee
actor-start$0.005Once per run, only if you go past 1,000 rows
row$0.0002Each row after the first 1,000

Store discount tiers: free-plan and Bronze users pay the prices above. Silver gets 10% off and Gold (and higher) gets 20% off.

Free: invalid input (exit 0, $0), permission errors that name the email to share with, empty source data.

Examples: 500 rows → $0. 5,000 rows → $0.005 + 4,000 × $0.0002 = $0.805.

Tips

  • Keep serviceAccountJson marked secret in saved tasks.
  • Use mode=append when you do not want a “replace wiped my sheet” surprise.
  • Cap spend with maxRows and Apify’s maxTotalChargeUsd.
  • Default memory is 512 MB.

Self-test

Set "selfTest": true to run offline checks of append/replace/upsert planning, formula escaping, URL parsing and JWT signing. If a spreadsheet URL and service account are also provided (our private daily schedule does this), a one-row live write/read runs on the SelfTest tab. Leave selfTest off for normal use.

FAQ

How do I export an Apify dataset to Google Sheets?

Create a Google Cloud service account, share your sheet with its email as Editor, then run this Actor with the sheet URL, the dataset (or run ID) and the service account JSON as a secret. Choose append, replace or upsert.

What is the difference between append, replace and upsert?

Append adds rows after the existing data. Replace clears the tab and writes new headers and rows. Upsert updates rows whose key column matches (for example email) and appends the rest.

Why no OAuth?

A service account has no consent screen and no refresh token that can expire after months of inactivity. The trade-off is a one-time Google Cloud setup of about five minutes.

What does it cost?

The first 1,000 rows of every run are free with no start fee. After that, $0.005 per run plus $0.0002 per row. 500 rows cost $0; 5,000 rows cost $0.805.

What happens if I run the default example?

The default input reads Google's public sample Class Data sheet (student name, class, major and so on) in mode=read, with no service account. You get the real rows from that sheet and are not charged. To write to your own sheet, switch to append, replace or upsert, paste your sheet URL and a service account key, and share the sheet with that account as Editor.