# Google Sheets Export & Import (No OAuth) (`latentlark/sheets-export`) Actor

Send any Apify dataset or JSON to Google Sheets, or read a sheet into a dataset. No Google login or expiring OAuth tokens: just share your sheet with our service account. Append, replace, dedupe, pick columns, flatten nested JSON.

- **URL**: https://apify.com/latentlark/sheets-export.md
- **Developed by:** [LatentLark](https://apify.com/latentlark) (community)
- **Categories:** Integrations, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Google Sheets Export & Import (No OAuth)

**Google OAuth tokens expire or get revoked, and then your scheduled exports silently stop.** This Actor doesn't use OAuth at all. You share your sheet once with our service account (`sheets-export@latentlark.iam.gserviceaccount.com`), and every scheduled run keeps writing to it: no "Sign in with Google", no token to refresh, no broken schedule next month.

Send any **Apify dataset** (or plain JSON) to a **Google Sheet**, or read a sheet back into a dataset. Append with duplicate skipping, replace, pick columns, flatten nested JSON.

![Jobs from Career Page Jobs API appended to a Google Sheet by this Actor, with no Google login](https://api.apify.com/v2/key-value-stores/Tv899H9p8Kim9T8M2/records/jobs-in-google-sheets.png?signature=lWqMaV8G28EGnQjfChzv)

**Try it in one click:** the input is prefilled with a read-only [demo sheet with 8 sample jobs](https://docs.google.com/spreadsheets/d/1x1XuD8S3BtAn7idKN8bLQ8UhNM-ucCQWqxD3l_CQ17k/edit#gid=1874420385) (tab *Sample jobs*, open it to browse the data). Click **Start** with the defaults to read it into a dataset, then swap in your own sheet URL to export or import your data. The demo sheet is read-only: `append` or `replace` on it is refused with a clear message, so use your own sheet for writing.

### Daily jobs → Google Sheet in 3 minutes

Pair it with [Career Page Jobs API](https://apify.com/latentlark/ats-career-jobs) (Workday, Personio, Greenhouse, Lever, Ashby and more) to get a sheet that fills itself with new job openings every day:

1. In Career Page Jobs API, add your companies and set `onlyNewSinceLastRunKey` (e.g. `my-watchlist`). Save it as a task and give it a daily **Schedule**.
2. Share your sheet with `sheets-export@latentlark.iam.gserviceaccount.com` as **Editor**.
3. On that task, open **Integrations** → **Add integration** → **Actor**, choose this Actor, trigger **Run succeeded**, input:
   `{"spreadsheet": "YOUR_SHEET_URL", "datasetId": "{{resource.defaultDatasetId}}", "mode": "append", "dedupeBy": ["url"]}`

Every morning the new jobs land in your sheet. Rows whose `url` is already there are skipped and not billed. The same pattern works after any scraper.

**How the first run looks** (fill the form, click Start, get results):

![Walkthrough: paste your sheet URL, click Start, then the rows appear in your Google Sheet](https://api.apify.com/v2/key-value-stores/Tv899H9p8Kim9T8M2/records/sheets-export-walkthrough.gif?signature=1Kz85Xfm0bxJUu3p2FUkX)

### This Actor vs the free Google Sheets Actor

The popular free [Google Sheets Import & Export](https://apify.com/lukaskrivka/google-sheets) Actor is mature and has more processing options (modify mode, backups, custom transform functions). Pick based on how you'll run it:

| | Free Google Sheets Actor | This Actor |
|---|---|---|
| Google access | OAuth: connect your Google account, then pick a sheet | No login: share one sheet with a service account |
| What it can reach | Sheets in the connected Google account | Only the sheets you share with it |
| Long-running schedules | Stop when the OAuth token expires or is revoked, until you reconnect | Keep working as long as the sheet stays shared |
| Price | Free Actor, you pay platform usage | Small per-run + per-row fee, platform usage included |
| Best for | One-off or hands-on imports and exports | Unattended scheduled exports and integrations |

### What it does

- **Export a dataset to Google Sheets.** Use any dataset ID, the dataset of the run that just finished (as an integration), or JSON you paste in.
- **Append**: add rows below the existing data. The header row is created automatically, and new fields become new columns at the right. Your column order is kept.
- **Replace**: clear the tab and write a fresh snapshot.
- **Read**: import a tab into a dataset, with one item per row and the header row as keys.
- **Skip duplicates** by one or more columns (e.g. `url`), checked against rows already in the sheet. This is ideal for daily scheduled scrapes.
- **Pick and order columns**, or exclude some (e.g. long `description` fields).
- **Flatten nested JSON**: `{"company": {"name": "X"}}` becomes the column `company.name`. Arrays can be joined into one cell, kept as JSON text, or split into one column per element.
- **Large datasets**: rows are written in batches of 2,000. Google rate limits (429) and server errors are retried automatically with backoff.
- **Safe by default**: values are written as raw values, so text like `=IMPORTXML(...)` from scraped pages is never executed as a formula. Turn on *Let Sheets parse values* if you want formulas or dates parsed.
- **Clear errors.** For example, *"Share the sheet with sheets-export@latentlark.iam.gserviceaccount.com as Editor"* tells you exactly what to fix.

### Setup (1 minute)

1. Open your Google Sheet. You can create one at [sheets.new](https://sheets.new).
2. Click **Share**, add **`sheets-export@latentlark.iam.gserviceaccount.com`**, choose **Editor**, untick *Notify people* and click **Share**.
3. Paste the sheet URL into **Google Sheet URL** and choose a dataset or paste JSON.
4. Click **Start**.

The service account can only access sheets that you explicitly share with it, and you can remove access at any time from the Share dialog. For read mode, *Viewer* access is enough, and so is a sheet that is public to anyone with the link.

### Use it as an integration (after any Actor)

To send every run of a scraper to a sheet automatically:

1. Open your scraper (or its saved task) → **Integrations** → **Add integration** → **Actor**.
2. Choose this Actor and the trigger **Run succeeded**.
3. Use this input:

```json
{
  "spreadsheet": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit",
  "datasetId": "{{resource.defaultDatasetId}}",
  "mode": "append",
  "dedupeBy": ["url"]
}
```

4. Schedule the scraper. Each run adds only the new rows to your sheet.

From the API:

```bash
curl -X POST "https://api.apify.com/v2/acts/latentlark~sheets-export/runs?token=YOUR_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"spreadsheet":"YOUR_SHEET_URL","mode":"append","jsonData":[{"name":"Alice","score":10}]}'
```

### Input

| Field | Meaning |
|---|---|
| `spreadsheet` | Sheet URL or ID (required). A `#gid=` in the URL selects that tab. |
| `mode` | `read` (form default, works with the demo sheet), `append` or `replace`. Set `append` or `replace` explicitly to write. |
| `datasetId` | Dataset to export. In integrations, use `{{resource.defaultDatasetId}}`. |
| `jsonData` | Array of objects to write instead of a dataset. |
| `sheetName` | Tab name. It is created if it is missing. |
| `columns` / `excludeColumns` | Choose and order columns, or drop some. |
| `dedupeBy` | Columns that identify a row; duplicates are skipped. |
| `flatten`, `arrayMode`, `flattenSeparator` | How nested data becomes columns. |
| `parseValues` | Let Sheets parse formulas, dates and currencies (off by default). |
| `maxRows` | Stop after this many rows. |
| `serviceAccountJson` | Optional: use your own service account key (stored encrypted). |

### Output

The run's key-value store record **OUTPUT** contains the spreadsheet URL, the tab name, `rowsWritten`, `rowsSkippedDuplicates`, the columns, and any columns that were added. In read mode, the rows are stored in the run's dataset.

### Pricing

You pay **$0.005 per run** plus **$0.0003 per row** written or read ($0.30 per 1,000 rows). Duplicates that are skipped are free. Platform usage is included. Example: a daily run that appends 200 new jobs costs about $0.065.

### FAQ

**How is this different from the Google Sheets Actor that asks me to log in with Google?**
That Actor uses OAuth: you grant broad access to your Google Drive, and the token can expire or be revoked, which makes scheduled runs fail until you log in again. This Actor never asks for your Google login. It can only touch the sheets you share with it, and that access does not expire.

**Do I need a Google Cloud account?**
No. Just share the sheet. If your organisation blocks sharing with outside accounts, you can create your own service account (see below) and paste its key into `serviceAccountJson`.

**Using your own service account (optional)**

1. Create a project at https://console.cloud.google.com/projectcreate. No billing account is needed.
2. Enable the Sheets API at https://console.cloud.google.com/apis/library/sheets.googleapis.com.
3. Go to https://console.cloud.google.com/iam-admin/serviceaccounts → **Create service account**. Give it a name; no roles are needed.
4. Open the account → **Keys** → **Add key** → **Create new key** → **JSON**. A file downloads.
5. Paste the whole file into `serviceAccountJson`, then share your sheet with that account's `client_email` as Editor.

If key creation is blocked, your organisation's policy `iam.disableServiceAccountKeyCreation` is on. Ask your admin, or use a personal Google account.

**What are the limits?**
Google allows 10 million cells per spreadsheet and 50,000 characters per cell (longer values are cut). Rate limits are handled automatically.

**Can it update existing rows?**
Not yet. Use `replace` for a fresh snapshot, or `append` + `dedupeBy` to only add new rows.

**Is my data stored?**
Rows pass through the run and are written to your sheet. Nothing is kept outside your own Apify storage.

### More from LatentLark

- [Career Page Jobs API](https://apify.com/latentlark/ats-career-jobs): every open job from Workday, Personio, Greenhouse, Lever, Ashby and 3 more ATS as clean JSON, with only-new-jobs monitoring.
- [Competitor Ads Monitor](https://apify.com/latentlark/competitor-ads-monitor): track competitor ads from Google Ads Transparency Center and LinkedIn Ad Library, with new-ad alerts.
- [Telegram Channel Monitor](https://apify.com/latentlark/telegram-channel-monitor): scrape and monitor public Telegram channels (posts, views, reactions) with no login, only-new mode and webhooks.

# Actor input Schema

## `spreadsheet` (type: `string`):

URL (or ID) of your Google Sheet. Share the sheet with sheets-export@latentlark.iam.gserviceaccount.com as Editor first (Share button in Google Sheets). A #gid=... in the URL selects that tab. The prefilled URL is a read-only demo sheet with sample jobs: click Start to try a read, then replace it with your own sheet.

## `mode` (type: `string`):

read: import the tab into this run's dataset (default, works with the demo sheet). append: add rows below existing data (header is created or extended). replace: clear the tab and write fresh.

## `datasetId` (type: `string`):

Apify dataset ID or name. In an integration (run after another Actor) use {{resource.defaultDatasetId}}.

## `jsonData` (type: `array`):

Rows to write directly, as a JSON array of objects. Used instead of the dataset when set.

## `sheetName` (type: `string`):

Tab (worksheet) to use. Created automatically in append/replace mode if it doesn't exist. Empty = tab from the URL's #gid, else the first tab.

## `columns` (type: `array`):

Only these columns, in this order. Use flattened names for nested fields, e.g. company.name. Empty = all columns.

## `excludeColumns` (type: `array`):

Columns to leave out, e.g. description.

## `dedupeBy` (type: `array`):

Rows whose value(s) in these columns already exist in the sheet (or earlier in this run) are skipped, e.g. url or id. Ideal for scheduled runs.

## `flatten` (type: `boolean`):

{"company": {"name": "X"}} becomes a column company.name.

## `arrayMode` (type: `string`):

How to put arrays into cells.

## `flattenSeparator` (type: `string`):

Character(s) joining nested keys in column names, e.g. "." gives company.name.

## `headerRow` (type: `boolean`):

Read mode: use the first row as field names. Off: fields are named column1, column2, ...

## `parseValues` (type: `boolean`):

Off (default, safe): values are stored exactly as text/numbers; formulas are not executed. On: Sheets parses dates, currencies and =formulas as if typed.

## `maxRows` (type: `integer`):

Stop after this many rows (0 = no limit).

## `serviceAccountJson` (type: `string`):

Optional. Paste a Google service account JSON key to write as your own service account instead of ours (useful for org policies or high volume). Stored encrypted.

## Actor input object example

```json
{
  "spreadsheet": "https://docs.google.com/spreadsheets/d/1x1XuD8S3BtAn7idKN8bLQ8UhNM-ucCQWqxD3l_CQ17k/edit#gid=1874420385",
  "mode": "read",
  "flatten": true,
  "arrayMode": "join",
  "flattenSeparator": ".",
  "headerRow": true,
  "parseValues": false
}
```

# Actor output Schema

## `summary` (type: `string`):

Spreadsheet URL, tab, rows written/read, duplicates skipped, columns.

## `rows` (type: `string`):

Rows imported from the sheet in read mode.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "spreadsheet": "https://docs.google.com/spreadsheets/d/1x1XuD8S3BtAn7idKN8bLQ8UhNM-ucCQWqxD3l_CQ17k/edit#gid=1874420385",
    "mode": "read"
};

// Run the Actor and wait for it to finish
const run = await client.actor("latentlark/sheets-export").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "spreadsheet": "https://docs.google.com/spreadsheets/d/1x1XuD8S3BtAn7idKN8bLQ8UhNM-ucCQWqxD3l_CQ17k/edit#gid=1874420385",
    "mode": "read",
}

# Run the Actor and wait for it to finish
run = client.actor("latentlark/sheets-export").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "spreadsheet": "https://docs.google.com/spreadsheets/d/1x1XuD8S3BtAn7idKN8bLQ8UhNM-ucCQWqxD3l_CQ17k/edit#gid=1874420385",
  "mode": "read"
}' |
apify call latentlark/sheets-export --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,latentlark/sheets-export"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tkUJMNmfgdC8qFc5W/builds/HplVGOmQG9t5QReUh/openapi.json
