# Google Sheets Export Pro: Append, Upsert & Replace (`grace_hartwell/google-sheets-export-pro`) Actor

Export Apify datasets or JSON to Google Sheets reliably: append, upsert by key (no duplicates) or replace. Batched, auto-retry on 429, resumable. Pay per row.

- **URL**: https://apify.com/grace_hartwell/google-sheets-export-pro.md
- **Developed by:** [Grace M. Hartwell](https://apify.com/grace_hartwell) (community)
- **Categories:** Integrations, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 row writtens

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

<img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/dpsKHwXKHdbwBgwOT-profile-dxtJoi0ame-avatar-hartwell-800.png" alt="Hartwell Toolworks" width="96" height="96" />

**Google Sheets Export Pro** exports **Apify datasets or any JSON items to Google Sheets**, and it keeps working on large and repeated exports. Choose **append** (add rows), **upsert** (update rows by a key column, add new ones, **no duplicates**) or **replace** (overwrite the tab). Writes are batched, retried automatically on Google's `429 Too Many Requests` and `5xx` errors, and resumed after a migration. Every error tells you exactly what to fix. You pay **$0.50 per 1,000 rows written** plus $0.005 per run. **Unchanged rows, skipped rows and dry runs are free.**

### What can you use Google Sheets Export Pro for?

- 📈 **Scraper → Google Sheets every day**: send product prices, job posts, leads or reviews to a sheet after each scheduled run.
- 🔁 **Keep one up-to-date table instead of duplicates**: *upsert* by `url`, `id` or `sku`. Existing rows are updated in place, new items are appended, unchanged rows are skipped and cost nothing.
- 🧹 **Live dashboards**: *replace* refreshes a tab that charts, pivot tables or Looker Studio read from.
- 🔌 **n8n, Make and Zapier workflows**: pass JSON items or a dataset ID and get a summary back.
- 🧩 **Clean data first, then export**: chain it after [Merge & Deduplicate Datasets](https://apify.com/grace_hartwell/dataset-merge-dedup) to merge several scraper runs, then upsert the result into one sheet.

### Why it is more reliable

- ✅ **Pre-flight checks** before anything is written: credentials, the spreadsheet ID, edit access, the tab and the 10-million-cell limit.
- 🧱 **Idempotent writes**: every batch is written to explicit row numbers, so a retry or a resumed run overwrites the same rows and never appends them twice.
- 🔄 **Backoff on 429/5xx**: exponential backoff with jitter, honours `Retry-After`, up to 9 attempts (max 64 s wait), plus a client-side throttle (default 50 requests per minute, below Google's per-user quota of 60).
- 💾 **Resumable**: a checkpoint (`STATE` in the run's key-value store) is saved after every batch. After a platform migration or restart the run continues where it stopped and does not charge the same rows again.
- 📏 **Within Sheets limits**: requests are split by rows (`batchSize`) and by size (about 2 MB), the grid is expanded before writing, the 10,000,000-cell limit is checked up front, and cells over 50,000 characters are truncated and reported.
- 🧠 **Quota-friendly upsert**: the existing sheet is read in a few large windows, about 200,000 cells per request. Only a 32-bit hash per cell is kept in memory, at most 40 MB for a full 10M-cell spreadsheet.
- 🔐 **Credentials stay secret**: the key is a secret input field (encrypted by Apify) and is never logged. Error messages are redacted.
- 🔒 **Limited permissions**: the Actor only needs READ access to the one dataset you pick. It uses no Standby mode and defaults to 512 MB of memory.

### How to export an Apify dataset to Google Sheets

1. **Create a service account** (one time, about 3 minutes):
   1. Open [Google Cloud Console](https://console.cloud.google.com/) → create or select a project.
   2. **APIs & Services → Library → Google Sheets API → Enable**.
   3. **IAM & Admin → Service accounts → Create service account** (no roles needed).
   4. Open the account → **Keys → Add key → Create new key → JSON**. A `.json` file downloads.
2. **Share your spreadsheet** with the service account's e-mail (`client_email` in the JSON, e.g. `sheets-export@your-project.iam.gserviceaccount.com`) as **Editor**. Untick "Notify people".
3. In this Actor:
   - **Dataset**: pick the dataset, e.g. the default dataset of your scraper run.
   - **Spreadsheet ID or URL**: paste the sheet's URL.
   - **Sheet (tab) name**: e.g. `Products`. The tab is created if it is missing.
   - **Write mode**: `append`, `upsert` (+ **Key column(s)**, e.g. `url`) or `replace`.
   - **Service account key (JSON)**: paste the whole JSON file.
4. Click **Start**. The summary shows the sheet link and the number of rows appended, updated and skipped.

> Tip: turn on **Dry run** first. It checks access and shows what would be appended or updated, without writing or charging rows. Without credentials, it previews the columns offline.

### Write modes

| Mode | What happens | Typical use |
| --- | --- | --- |
| `append` | Rows are added below the last row with data. New fields become new columns at the end of the header. | Logs, history, "everything we ever scraped" |
| `upsert` | Rows whose **key column(s)** already exist are updated in place. New keys are appended. Unchanged rows are skipped (free). If a key appears several times in the input, the **last occurrence wins**, so no duplicate rows are created. | Price trackers, CRM-style lead lists, job boards, daily scrapes |
| `replace` | The tab is overwritten with this data. Old rows and columns beyond the new data are cleared after the new rows are written, so the tab is never empty in between. | Dashboards, "current snapshot" tabs |

### Columns, nested JSON and arrays

- **Flattening**: `{"price": {"value": 9.5, "currency": "EUR"}}` → columns `price.value` and `price.currency` (dot notation, up to `maxDepth`).
- **Arrays**: `join` (`["a","b"]` → `a, b`; arrays of objects become JSON), `json`, or `index` (`tags.0`, `tags.1`, …).
- **Header handling**: `merge` keeps your existing header order and adds new columns at the end. `existing-only` never adds columns; extra fields are dropped and listed in the summary.
- **Column order / whitelist**: `columns: ["title", "price.value", "url"]`. Turn on `onlyListedColumns` to export only these columns.
- **Value input option**: `RAW` (default; values stay exactly as sent, numbers stay numbers) or `USER_ENTERED` (Google parses dates and percentages). Key cells always stay text, so `00123` never turns into `123`. Values starting with `=` are written as text, so scraped content cannot run formulas (`escapeFormulas`).
- If the Actor writes the header into an empty tab, the header row is frozen.

### Input example

```json
{
    "datasetId": "aBcD1234EfGh5678",
    "spreadsheetId": "https://docs.google.com/spreadsheets/d/1AbC...xyz/edit#gid=0",
    "sheetName": "Products",
    "mode": "upsert",
    "keyColumns": ["url"],
    "columns": ["url", "title", "price.value", "price.currency"],
    "arrayMode": "join",
    "valueInputOption": "RAW",
    "batchSize": 1000,
    "serviceAccountKey": "{ \"type\": \"service_account\", ... }"
}
```

| Field | Default | Description |
| --- | --- | --- |
| `datasetId` / `items` | – | Dataset to export (READ access via the picker), **or** an array of JSON items. A webhook payload with `resource.defaultDatasetId` also works. |
| `datasetOffset` / `datasetLimit` | `0` / all | Export only a slice, e.g. to split very large datasets. |
| `spreadsheetId` | – | Spreadsheet URL or ID. A `#gid=` in the URL selects that tab if `sheetName` is empty. |
| `sheetName` / `createSheetIfMissing` | first tab / `true` | Target tab, created if it is missing. |
| `mode` | `append` | `append`, `upsert` or `replace`. |
| `keyColumns` | – | Key for upsert, e.g. `["url"]` or `["shop", "product.id"]`. |
| `skipUnchangedRows` / `missingFieldsOnUpdate` / `rowsWithoutKey` | `true` / `keep` / `skip` | Upsert details. |
| `caseInsensitiveKeys` / `trimKeys` | `false` / `true` | How keys are compared. |
| `columns` / `onlyListedColumns` / `headerMode` | – / `false` / `merge` | Column order, whitelist and header handling. |
| `flattenObjects` / `arrayMode` / `arraySeparator` / `maxDepth` | `true` / `join` / `", "` / `10` | Flattening. |
| `valueInputOption` / `escapeFormulas` / `freezeHeaderRow` | `RAW` / `true` / `true` | How values are written. |
| `serviceAccountKey` / `oauthAccessToken` | – | Credentials (secret fields). The service account is recommended. OAuth tokens expire after about 1 hour. |
| `batchSize` / `maxRequestsPerMinute` / `maxRowsToWrite` | `1000` / `50` / no limit | Limits. |
| `dryRun` | `false` | Check and count without writing or charging rows. |

### Output

The Actor stores a summary as `OUTPUT` in the key-value store and as one record in the dataset:

```json
{
    "status": "SUCCEEDED",
    "mode": "upsert",
    "sheetUrl": "https://docs.google.com/spreadsheets/d/1AbC...xyz/edit#gid=0",
    "sheetTitle": "Products",
    "itemsRead": 51000,
    "rowsWritten": 6000,
    "rowsAppended": 1000,
    "rowsUpdated": 5000,
    "rowsUnchanged": 45000,
    "rowsSkippedMissingKey": 0,
    "duplicateKeysInInput": 0,
    "columns": ["id", "title", "price.value", "price.currency", "stock", "tags", "seller.name", "seller.city", "url"],
    "columnsAdded": [],
    "rowsCharged": 6000,
    "apiRequests": 32,
    "apiRetries": 0,
    "stoppedReason": null
}
```

If a run fails, the summary has `status: "FAILED"`, an `errorCode` and an `error` message that says what to fix.

### Error messages you might see (and what to do)

| `errorCode` | Meaning |
| --- | --- |
| `SHEET_NOT_SHARED` | The sheet is not shared with the service account, or only as Viewer. The message shows the **exact e-mail** to add as Editor. |
| `API_NOT_ENABLED` | The Google Sheets API is off in your Cloud project. The message includes the link to enable it. |
| `SPREADSHEET_NOT_FOUND` | Wrong ID or URL. |
| `NOT_A_GOOGLE_SHEET` | The file is an uploaded `.xlsx`. Use **File → Save as Google Sheets**. |
| `TAB_NOT_FOUND` | The tab does not exist and creating tabs is off. The message lists the existing tabs. |
| `CELL_LIMIT_EXCEEDED` | The spreadsheet would pass 10,000,000 cells. Checked before writing; if it happens mid-run, the message tells you where to continue. |
| `QUOTA_EXCEEDED` / `GOOGLE_UNAVAILABLE` | Still failing after all retries. Lower the request rate or try again later. |
| `KEY_INVALID` / `AUTH_KEY_REJECTED` / `TOKEN_EXPIRED` | Broken, deleted or expired credentials. |
| `PROTECTED_RANGE` | The tab or a range in it is protected. |

### How much does it cost to export to Google Sheets?

Pay per event, with no subscription:

| Event | Price | When |
| --- | --- | --- |
| `row-written` | **$0.0005** per row ($0.50 per 1,000) | A row was appended or updated, charged after Google confirmed the write |
| `apify-actor-start` | **$0.005** per run | At run start (default 512 MB = one start event) |

**Free:** unchanged rows (upsert), rows skipped for a missing key, duplicate keys in the input, the header row, cleared rows (replace) and dry runs.

| Example | Cost |
| --- | --- |
| Append 1,000 scraped rows | 1,000 × $0.0005 + $0.005 = **$0.505** |
| Daily upsert of 5,000 products, 400 changed + 100 new | 500 × $0.0005 + $0.005 = **$0.255 per day** (about $7.65 per month) |
| Replace a 200-row dashboard tab every hour | 200 × $0.0005 + $0.005 = **$0.105 per run** |
| Dry run of any size | **$0.005** |

**Budget-safe:** set *Max total charge* on the run. The Actor never writes more rows than your budget covers. It stops gracefully with `stoppedReason: "max-charge-reached"` and a complete summary.

### Use it from n8n, Make, Zapier or the API

**Apify integrations (no code)**: on your scraper's **Integrations** tab, add this Actor as a follow-up step and set the input `"datasetId": "{{resource.defaultDatasetId}}"`. After every run, the new results land in your sheet.

**n8n**: use the Apify node ("Run Actor") or an **HTTP Request** node:

```
POST https://api.apify.com/v2/acts/grace_hartwell~google-sheets-export-pro/runs?waitForFinish=300
Authorization: Bearer <your Apify API token>
Content-Type: application/json

{ "items": {{ JSON.stringify($json.items) }}, "spreadsheetId": "<sheet URL>", "sheetName": "Leads",
  "mode": "upsert", "keyColumns": ["email"], "serviceAccountKey": "<JSON key>" }
```

Then read the `OUTPUT` record of the run's default key-value store for the counts and the sheet URL.

**Make**: Apify app → *Run an Actor* → `grace_hartwell/google-sheets-export-pro` with the same JSON input → *Get record* `OUTPUT`.

**JavaScript**:

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('grace_hartwell/google-sheets-export-pro').call({
    datasetId: 'aBcD1234EfGh5678',
    spreadsheetId: 'https://docs.google.com/spreadsheets/d/1AbC...xyz/edit',
    sheetName: 'Products',
    mode: 'upsert',
    keyColumns: ['url'],
    serviceAccountKey: process.env.GOOGLE_SA_KEY,
});
const summary = await client.keyValueStore(run.defaultKeyValueStoreId).getRecord('OUTPUT');
console.log(summary.value.rowsAppended, summary.value.rowsUpdated, summary.value.sheetUrl);
```

**Combine with deduplication**: [Merge & Deduplicate Datasets](https://apify.com/grace_hartwell/dataset-merge-dedup) (merge several runs, only new items) → this Actor in `upsert` mode → one clean, current sheet.

### Our test

Tested with automated tests and a local Google Sheets API simulator that injects `429` and `503` errors, missing tabs, permission errors, a disabled API and the cell limit. Example: 50,000 rows were appended in 55 requests. An upsert of 51,000 items (5,000 changed, 1,000 new) then took 32 requests: 1,000 rows appended, 5,000 updated, 45,000 unchanged and free, and no duplicate keys. A run stopped after 2 of 5 batches resumed to exactly 500 rows, with no duplicates and no double charge. Speed on real Google Sheets depends on Google's quotas. *Hartwell Toolworks, Oct 2026.*

### FAQ

#### Do I need a Google Cloud billing account?

No. The Google Sheets API is free to use within its default quotas. You only need a Google Cloud project with the Sheets API enabled and a service account.

#### Why a service account and not "Sign in with Google"?

A service account works unattended in schedules and never expires. You decide exactly which spreadsheets it can access by sharing them. An OAuth access token also works for one-off runs.

#### How does upsert avoid duplicates?

It reads the key column(s) of the existing tab, matches every item by its key (composite keys allowed, optionally case-insensitive) and updates the matching row. New keys are appended. If a key appears several times in the input, only its last occurrence is written.

#### What happens when the dataset has new fields?

In `merge` mode, new fields become new columns at the end of the header. Existing columns are never reordered, so your formulas and charts keep working.

#### Can I export more than 10 million cells?

No. That is Google's hard limit per spreadsheet, and it counts all tabs including empty grid cells. The Actor checks this before writing. Use several spreadsheets, `onlyListedColumns`, or split the export with `datasetOffset`/`datasetLimit`.

#### Will a failed or aborted run leave half-written data?

Rows that were written stay in the sheet. After a platform migration the same run resumes on its own. If a run fails, the message tells you how to continue: use `upsert`, which is always safe to repeat, or the exact `datasetOffset` for `append`.

#### Is my key safe?

The key is a secret input field (encrypted at rest by Apify), is never logged and is only sent to Google's OAuth endpoint as a signed token. Use a dedicated service account that has access only to the sheets you share with it.

### Limitations

- One tab per run. To fill several tabs, run the Actor several times.
- The header is always row 1, and data starts in row 2.
- Upsert compares values as Google returns them. With `USER_ENTERED`, values Google converts (dates, percentages) may be rewritten on every run. Use `RAW` for exact change detection.
- If the sheet already has duplicate keys, only the first matching row is updated.
- No cell formatting, colours or formulas, only values.
- Existing rows are never deleted in `append` or `upsert`. Only `replace` clears old rows.

### Other Actors by Hartwell Toolworks

| Actor | What it does |
| --- | --- |
| [Merge & Deduplicate Datasets](https://apify.com/grace_hartwell/dataset-merge-dedup) | Merge scraper runs, remove duplicates, only new items |
| [HTML to Markdown Converter for LLM & RAG](https://apify.com/grace_hartwell/html-to-markdown-json) | Turn scraped pages into clean Markdown |
| [Broken Link Checker & Redirect Chain Checker](https://apify.com/grace_hartwell/broken-link-redirect-auditor) | 404s, redirect chains and loops |

Found a bug or an edge case? Open an issue on the **Issues** tab.

# Changelog

This Actor's version history is a separate document: https://apify.com/grace_hartwell/google-sheets-export-pro/changelog.md

# Actor input Schema

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

The Apify dataset to export, e.g. the default dataset of a scraper run. The picker grants this run READ access to exactly this dataset (limited permissions). In integrations, pass {{resource.defaultDatasetId}}.

## `items` (type: `array`):

Array of JSON objects to export, e.g. from n8n, Make or your own code. Use either this or "Dataset".

## `datasetOffset` (type: `integer`):

Start at this item index (for splitting very large exports).

## `datasetLimit` (type: `integer`):

Read at most this many items. Empty = all.

## `spreadsheetId` (type: `string`):

Paste the Google Sheets URL (https://docs.google.com/spreadsheets/d/<ID>/edit#gid=0) or just the ID. A #gid in the URL selects that tab when "Sheet (tab) name" is empty.

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

Tab to write to, e.g. "Leads". Empty = the tab from the URL's #gid, otherwise the first tab.

## `createSheetIfMissing` (type: `boolean`):

Creates the tab named above when it does not exist yet.

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

append: add rows below the existing data. upsert: update rows whose key already exists and append new ones – no duplicates, ideal for scheduled scrapers. replace: overwrite the tab with this data (old rows below are cleared).

## `keyColumns` (type: `array`):

Column(s) that identify a row, e.g. \["url"] or \["shop", "product.id"] (dot notation for nested fields). Required for upsert.

## `skipUnchangedRows` (type: `boolean`):

Do not rewrite (or charge) rows whose values are already identical in the sheet.

## `missingFieldsOnUpdate` (type: `string`):

keep: leave the existing cell untouched. clear: empty the cell.

## `rowsWithoutKey` (type: `string`):

What to do with items whose key column(s) are all empty.

## `caseInsensitiveKeys` (type: `boolean`):

Treat "ABC" and "abc" as the same key.

## `trimKeys` (type: `boolean`):

Ignore leading/trailing spaces when matching keys.

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

Column order for the header, e.g. \["title", "price.value", "url"]. Other columns follow unless "Only listed columns" is on.

## `onlyListedColumns` (type: `boolean`):

Export only the columns listed above (plus key columns).

## `headerMode` (type: `string`):

merge: keep the existing header and add new columns at the end. existing-only: never add columns; fields without a column are dropped (reported in the summary).

## `flattenObjects` (type: `boolean`):

{"price":{"value":9}} becomes column price.value. Off = JSON text in one cell.

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

join: \["a","b"] → "a, b" (arrays of objects become JSON). json: JSON text. index: tags.0, tags.1 … columns.

## `arraySeparator` (type: `string`):

Separator for joined arrays.

## `maxDepth` (type: `integer`):

Deeper objects are written as JSON text.

## `valueInputOption` (type: `string`):

RAW: values are stored exactly as sent (safest; numbers stay numbers). USER_ENTERED: Google parses values like typed by a user (dates, percentages). Key cells always stay text.

## `escapeFormulas` (type: `boolean`):

Prevents scraped values starting with "=" from being executed as formulas.

## `freezeHeaderRow` (type: `boolean`):

Freeze row 1 when the Actor writes the header into an empty tab.

## `serviceAccountKey` (type: `string`):

Paste the full JSON key of a Google Cloud service account (Google Cloud Console → IAM & Admin → Service accounts → Keys → Add key → JSON). Enable the Google Sheets API in that project and share the spreadsheet with the key's client_email as Editor. Stored encrypted, never logged.

## `oauthAccessToken` (type: `string`):

Optional instead of a service account: a Google OAuth 2.0 access token with scope https://www.googleapis.com/auth/spreadsheets (valid ~1 hour, so not suited for schedules). Never logged.

## `batchSize` (type: `integer`):

Rows per write request. Requests are additionally split at ~2 MB. Larger = fewer API calls.

## `maxRequestsPerMinute` (type: `integer`):

Client-side throttle below Google's default quota of 60 requests per minute per user. 429 responses are retried with exponential backoff anyway.

## `maxRowsToWrite` (type: `integer`):

Stop after this many rows were appended/updated. Empty = no limit (your max total charge is respected anyway).

## `dryRun` (type: `boolean`):

Check access and compute what would be appended/updated without writing or charging anything. Works without credentials as an offline column preview.

## Actor input object example

```json
{
  "datasetOffset": 0,
  "createSheetIfMissing": true,
  "mode": "append",
  "skipUnchangedRows": true,
  "missingFieldsOnUpdate": "keep",
  "rowsWithoutKey": "skip",
  "caseInsensitiveKeys": false,
  "trimKeys": true,
  "onlyListedColumns": false,
  "headerMode": "merge",
  "flattenObjects": true,
  "arrayMode": "join",
  "arraySeparator": ", ",
  "maxDepth": 10,
  "valueInputOption": "RAW",
  "escapeFormulas": true,
  "freezeHeaderRow": true,
  "batchSize": 1000,
  "maxRequestsPerMinute": 50,
  "dryRun": false
}
```

# Actor output Schema

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

No description

## `results` (type: `string`):

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("grace_hartwell/google-sheets-export-pro").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("grace_hartwell/google-sheets-export-pro").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 '{}' |
apify call grace_hartwell/google-sheets-export-pro --silent --output-dataset

```

## MCP server setup

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

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/hJPh7tPCKrKq3JaAf/builds/QbETWZf6covT9rP9n/openapi.json
