# Google Sheets Export ($0.30/1K) - Any Dataset to Sheets (`carabain-digital/google-sheets-export`) Actor

Export any Apify dataset to a Google Sheet: replace the tab, append rows, or append only new items by a key field. Works as an integration after any Actor run, on a schedule or through the API.

- **URL**: https://apify.com/carabain-digital/google-sheets-export.md
- **Developed by:** [Carabain Digital](https://apify.com/carabain-digital) (community)
- **Categories:** Integrations, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 66.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.18 / 1,000 exported rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

#### What is Google Sheets Export?

**Google Sheets Export** copies **any Apify dataset into a Google Sheet**: the results of a scraper run, a saved dataset, or the output of any other Actor. It was built because the most used Google Sheets Actor on the Store fails about half of its runs. This one writes with a **Google service account** in **chunks with automatic retries** on Google's rate limits, so big exports finish. Choose **Replace** (a fresh copy every run), **Append** (add below) or **Append new** (only rows whose key is not in the sheet yet, ideal for scheduled runs). Nested data is **flattened into columns**, and you pick the columns and their order. Built for **scheduled scrapers, lead lists, price monitors and reports your team reads in Sheets**. Costs **$0.30 per 1,000 rows**.

- 📊 **Any dataset**: pick it in the input or pass its ID, from any Actor or task
- 🔁 **Three modes**: replace the tab, append, or append only new items by a key field
- 🧱 **Flattened columns**: `address.city`, lists as `a, b`, the rest as JSON text
- 🎯 **Choose your columns**: only the fields you list, in your order, dot paths for nested data
- 🛡️ **Safe values**: stored as raw text by default, so scraped text can never run as a formula
- 🔌 **Plug in anywhere**: Actor integration, schedule, API, webhooks, MCP / AI agents
- ♻️ **Reliable**: retries on Google quota and server errors, 5,000-row write chunks, tab created when missing

#### Use it from AI agents

This Actor has an agent skill for Claude Code, Codex, Cursor and other agents that read `SKILL.md`: it tells the agent when to use the Actor, every input field and the output. Install it with:

```bash
npx skills add carabain-digital/apify-agent-skills --skill google-sheets-export
```

Or read the skill on GitHub: [carabain-digital/apify-agent-skills/skills/google-sheets-export](https://github.com/carabain-digital/apify-agent-skills/tree/main/skills/google-sheets-export).

#### What data can I get?

<table>
<tr><td>📄 One sheet row per dataset item</td><td>🏷️ A header row with the field names</td></tr>
<tr><td>🧱 Nested fields as dot-path columns</td><td>📋 Lists as comma-separated text</td></tr>
<tr><td>➕ New fields as new columns (append)</td><td>🧾 A copy of the exported rows in the run's dataset</td></tr>
</table>

#### How do I export a dataset to Google Sheets?

1. [Create a free Apify account](https://console.apify.com/sign-up) and open this Actor.
2. Create a Google spreadsheet and **share it as Editor** with our service account: `sheets-export@apify-514417.iam.gserviceaccount.com`. Or bring your own: paste your service account's JSON key into **Your own service account key**.
3. Pick the **dataset** (or paste its ID) and paste the **spreadsheet URL**. Pick the tab name and the mode.
4. Click **Start**. The rows appear in your sheet and the status message tells you how many were exported.

To export automatically after another Actor, open that Actor's **Integrations** tab, add **Google Sheets Export** and set **Dataset** to `{{resource.defaultDatasetId}}`.

#### How much does it cost?

You pay per row written to your sheet: **$0.30 per 1,000 rows**, no subscription. Rows that were not written are not charged, and a run stops at the maximum cost you set. Example: exporting 50,000 rows costs about $15. The monthly credit of Apify's Free plan ($5) covers about 16,000 rows. Paid plans get volume discounts. Set **Max rows** to cap a run.

#### ⬇️ Input

| Field | Description |
|---|---|
| **Dataset** (`datasetId`) | Dataset to export (picker or ID). As an integration: `{{resource.defaultDatasetId}}` |
| **Google spreadsheet** (`spreadsheet`) | Spreadsheet URL or ID |
| **Sheet (tab) name** (`sheetName`) | Tab to write to, created when missing. Default `Sheet1` |
| **Mode** (`mode`) | `replace`, `append` or `appendNew` |
| **Key field** (`keyField`) | Required for `appendNew`: the field that identifies a row, e.g. `url` |
| **Fields** (`fields`) | Only these columns, in this order. Dot paths for nested fields. Empty = all |
| **Flatten nested data** (`flatten`) | On by default |
| **Max rows** (`maxRows`) | Export at most this many items |
| **Cell values** (`valueInputOption`) | `RAW` (default, safe) or `USER_ENTERED` (Google parses numbers, dates, formulas) |
| **Your own service account key** (`serviceAccountJson`) | Optional, stored encrypted. Empty = built-in account |

```json
{
    "datasetId": "WkzbQMuFYuamGv3YF",
    "spreadsheet": "https://docs.google.com/spreadsheets/d/1AbCdEfGhIjKlMnOpQrStUvWxYz0123456789/edit",
    "sheetName": "Leads",
    "mode": "appendNew",
    "keyField": "url",
    "fields": ["name", "url", "rating", "address.city"]
}
```

#### ⬆️ Output

The result is your Google Sheet. The run's dataset holds a receipt for every row that was written, and the status message names the sheet, for example `Exported 1250 rows to Leads / Sheet1.`

```json
{
    "sheet": "Leads / Sheet1",
    "mode": "appendNew",
    "row": {"name": "Hotel Aurora", "url": "https://example.com/aurora", "rating": 4.5, "address.city": "Lisbon"},
    "exportedAt": "2026-11-11T14:00:00+00:00"
}
```

#### What can I do with exported data?

- 📅 **Scheduled lead lists**: a scraper runs daily, Append new adds only today's new leads
- 💲 **Price monitoring sheet**: a fresh copy of the dataset every run, ready for charts and formulas
- 🧹 **Deduplicated scrape logs**: append by a key field such as `url` so rows never repeat
- 👥 **Team reports**: share results with people who live in Sheets, not in JSON
- 🔗 **Looker Studio dashboards**: use the sheet as a source for Looker Studio, Zapier, Make or Apps Script
- 🧠 **AI agents**: let an agent save research results to a sheet through MCP

#### ⚠️ Good to know

- **Sharing**: the spreadsheet must be shared with the service account as **Editor**. A 403 error in the status message names the email to share with.
- **Replace** clears the tab first and writes it again, so edits you made in that tab are lost. Use a separate tab for your own formulas.
- **Append** takes the header from the first row of the tab and adds fields it lacks as new columns at the end. **Append new** compares the Key field with the same column in the sheet as text.
- **Limits**: Google allows 10 million cells per spreadsheet and 50,000 characters per cell. The Actor stops early with a clear message when an export would not fit, and cuts longer text (the log counts them). Google allows about 60 write requests per minute; the Actor waits and retries when it is reached.
- **Flatten**: lists of plain values become `a, b`. Lists of objects and anything left over become one JSON text per cell.

#### Frequently asked questions

#### Can I use it with the Apify API?

Yes. Python:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("carabain-digital/google-sheets-export").call(run_input={
    "datasetId": "<DATASET_ID>",
    "spreadsheet": "https://docs.google.com/spreadsheets/d/<SPREADSHEET_ID>/edit",
    "mode": "replace"})
print(run["statusMessage"])
```

JavaScript:

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

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('carabain-digital/google-sheets-export').call({
    datasetId: '<DATASET_ID>',
    spreadsheet: 'https://docs.google.com/spreadsheets/d/<SPREADSHEET_ID>/edit',
    mode: 'appendNew',
    keyField: 'url',
});
console.log(run.statusMessage);
```

#### Can I use it through an MCP server or with AI agents?

Yes. Add it to an AI agent through the [Apify MCP server](https://mcp.apify.com) (`https://mcp.apify.com?tools=carabain-digital/google-sheets-export`). Example prompt: *"Use Google Sheets Export to append the new items of dataset <ID> to my spreadsheet, keyed on url."*

#### Do I have to share my spreadsheet with someone else's account?

With the built-in service account, yes: you share the sheet with its email (shown in the run log) as Editor, and the Actor only touches the spreadsheet you name. If you prefer not to, create your own service account in Google Cloud, enable the Google Sheets API, download its JSON key and paste it into **Your own service account key**. Then share the sheet with your own service account instead.

#### Is it legal to export data to Google Sheets?

The Actor only copies a dataset you own to a spreadsheet you own. If the data holds personal information (names, emails), GDPR and similar laws apply to how you store and share the sheet, so share it with the people who need it only. More background: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

#### Not working? Feedback

Open an issue on the **Issues** tab with the run link and we will look at it. Ideas are welcome there too.

#### Other tools by us

| Actor | Covers |
|---|---|
| [G2 Scraper](https://apify.com/carabain-digital/g2-scraper) | Software products per category with ratings, pros, cons, prices and reviews |
| [Google Trends Scraper](https://apify.com/carabain-digital/google-trends) | Search interest over time, by region, related queries, Trending now |
| [Reddit Scraper](https://apify.com/carabain-digital/reddit-scraper) | Posts, comments, subreddits and search |

⭐ **Does it work well for you?** A review on the Store page helps others find this Actor and helps us keep it maintained.

# Actor input Schema

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

ID, name or URL of the dataset to export (Storage > Datasets in the Console). As an integration of another Actor (Integrations tab), set it to `{{resource.defaultDatasetId}}` to export that run's results. Example: `WkzbQMuFYuamGv3YF`.

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

URL of the spreadsheet, or its ID (the part after `/spreadsheets/d/`). Share it with the service account as Editor first, see the Actor's README. Example: `https://docs.google.com/spreadsheets/d/1AbC.../edit`.

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

The tab to write to. It is created when it does not exist. Example: `Leads`.

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

Replace gives you a fresh copy every run. Append keeps the header of the sheet and adds new fields as new columns at the end. Append new skips rows already in the sheet: use it for scheduled runs.

## `keyField` (type: `string`):

The dataset field that identifies a row, compared with the same column in the sheet. Required for Append new, ignored otherwise. Example: `url` or `id`.

## `fields` (type: `array`):

Only these fields become columns, in this order. Use dot paths for nested fields. Empty = all fields, in the order they first appear. Example: `name`, `rating`, `address.city`.

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

Nested objects become columns named with a dot path (`address.city`), lists of plain values become `a, b`, and lists of objects become a JSON text in one cell. Off = every object or list is a JSON text.

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

Export at most this many items, from the start of the dataset. Empty = all. Example: `1000`.

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

Raw never turns text into formulas, so scraped text cannot run a formula in your sheet. Choose User entered only for data you trust.

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

The whole JSON key of a Google Cloud service account that has the Google Sheets API enabled and edit access to the spreadsheet. Stored encrypted. Empty = the built-in service account.

## Actor input object example

```json
{
  "datasetId": "MYsSEJZcfvwhcDzhC",
  "spreadsheet": "https://docs.google.com/spreadsheets/d/1dHj8fy3dQYtPf37NiTl1qj-YqwCzb3jcNLrkpzqIYRI/edit",
  "sheetName": "Sheet1",
  "mode": "replace",
  "flatten": true,
  "valueInputOption": "RAW"
}
```

# Actor output Schema

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

A copy of every row that was written to the Google Sheet, one item per row. The sheet itself is the main result.

# 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 = {
    "datasetId": "MYsSEJZcfvwhcDzhC",
    "spreadsheet": "https://docs.google.com/spreadsheets/d/1dHj8fy3dQYtPf37NiTl1qj-YqwCzb3jcNLrkpzqIYRI/edit",
    "sheetName": "Sheet1"
};

// Run the Actor and wait for it to finish
const run = await client.actor("carabain-digital/google-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 = {
    "datasetId": "MYsSEJZcfvwhcDzhC",
    "spreadsheet": "https://docs.google.com/spreadsheets/d/1dHj8fy3dQYtPf37NiTl1qj-YqwCzb3jcNLrkpzqIYRI/edit",
    "sheetName": "Sheet1",
}

# Run the Actor and wait for it to finish
run = client.actor("carabain-digital/google-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 '{
  "datasetId": "MYsSEJZcfvwhcDzhC",
  "spreadsheet": "https://docs.google.com/spreadsheets/d/1dHj8fy3dQYtPf37NiTl1qj-YqwCzb3jcNLrkpzqIYRI/edit",
  "sheetName": "Sheet1"
}' |
apify call carabain-digital/google-sheets-export --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,carabain-digital/google-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/gqQ4y9sROst6Sw2NY/builds/hLXsUAzmaOIhjoaRs/openapi.json
