Google Sheets MCP Server avatar

Google Sheets MCP Server

Pricing

Pay per usage

Go to Apify Store
Google Sheets MCP Server

Google Sheets MCP Server

MCP server for Google Sheets. AI agents can read, write, and manage spreadsheets. 14 tools: cell/range CRUD, formulas, batch operations, JSON export, and sheet tab management. Service account or API key auth.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

CQ

CQ

Maintained by Community

Actor stats

0

Bookmarked

13

Total users

7

Monthly active users

2 days ago

Last modified

Categories

Share

An MCP-style tool server that lets AI assistants (and any caller) read, write, and manage Google Sheets via the Google Sheets API v4. It exposes 14 tools covering cell/range read & write, append, sheet-tab management, formulas, JSON export, and batch operations.

This Actor is a thin, real wrapper around the official google-api-python-client. Every tool call makes a live request to the Google Sheets API using your credentials and input โ€” there is no mock or sample data.

Key features

  • ๐Ÿงฐ 14 real tools โ€” read/write cells & ranges, append rows, create/delete tabs, get/set formulas, export to JSON, and batch read+write in one call.
  • ๐Ÿ”— Live Google Sheets API v4 โ€” every call hits the official API with your credentials; no mock or sample data.
  • ๐Ÿ” Two auth modes โ€” a service-account JSON key for full read/write, or an API key for read-only access to public sheets.
  • ๐Ÿ“ฆ Batch operations โ€” combine multiple reads and writes in a single sheets_batch_update call.
  • ๐Ÿ›ก๏ธ Never crashes on bad input โ€” invalid credentials, an inaccessible sheet, or a malformed call return a structured success: false error, not a failed run.
  • โšก Fast request/response โ€” each run authenticates, executes the requested tool call(s), and exits (no long-lived socket to babysit).
  • ๐Ÿ”„ Automation-ready โ€” schedule it or call it from the Apify API to keep a sheet in sync with external data.

Use cases

  • Give an AI agent a spreadsheet โ€” let Claude/Cursor (via the Apify API or an integration) read and update a Google Sheet as part of a workflow.
  • Automated data logging โ€” append rows to a Sheet on a schedule (form responses, scrape results, metrics) for a live dashboard.
  • Pull sheet data into a pipeline โ€” export a tab to JSON and feed it to another actor, a model, or a BI tool.
  • Programmatic sheet management โ€” create/clear tabs, set formulas, and reformat ranges without opening the UI.
  • Two-way sync โ€” batch-read source ranges and batch-write computed results back in a single run.

What it does

You give the Actor:

  1. Credentials โ€” a Google service account JSON key (full read/write) or a Google API key (read-only).
  2. A target spreadsheet โ€” by spreadsheetId or full spreadsheetUrl.
  3. One or more tool calls โ€” toolCall (single) and/or toolCalls (array).

The Actor authenticates, loads the spreadsheet, runs each tool against the live API, and pushes one dataset record per result.

Authentication

ParameterAccess levelNotes
credentialsJsonFull read/writeGoogle service account JSON key. Accepts the raw JSON string or a base64-encoded copy of it. Required for any write/append/create/delete/clear/formula-set operation.
apiKeyRead-onlyGoogle API key. Can only read public spreadsheets (or those shared appropriately). Write tools will return a permission error from Google.

If both are supplied, credentialsJson is used first.

The Actor never crashes on missing or invalid credentials. If credentials are absent or malformed, it returns a clear, structured error and exits cleanly.

Input

FieldTypeRequiredDescription
credentialsJsonstring (secret)one auth method requiredService account JSON key (raw or base64).
apiKeystring (secret)one auth method requiredGoogle API key (read-only).
spreadsheetIdstringyes (or spreadsheetUrl)Spreadsheet ID, the part of the URL between /d/ and /edit.
spreadsheetUrlstringoptionalFull Sheets URL; the ID is extracted automatically. Used only if spreadsheetId is not set.
toolCallobjectoptionalA single tool to run: { "name": <tool>, "arguments": { ... } }.
toolCallsarrayoptionalA list of { "name", "arguments" } objects, run in order.

Example input

{
"credentialsJson": "{ ...service account JSON... }",
"spreadsheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms",
"toolCall": {
"name": "sheets_read_range",
"arguments": {
"range": "Sheet1!A1:D10",
"include_headers": true
}
}
}

Tools (14) and their arguments

ToolArgumentsAuth needed
sheets_read_cellcell (str, e.g. "A1" or "Sheet1!B2"), value_render (str, default "FORMATTED_VALUE")read
sheets_read_rangerange (str), value_render (str), include_headers (bool), max_rows (int)read
sheets_write_cellcell (str), value (any)write
sheets_write_rangerange (str), data (2D array)write
sheets_append_rowssheet (str, tab name), data (2D array)write
sheets_list_sheetsโ€”read
sheets_create_sheettitle (str), rows (int, default 1000), cols (int, default 26)write
sheets_delete_sheettitle (str)write
sheets_clear_rangerange (str)write
sheets_get_formulacell (str)read
sheets_set_formulacell (str), formula (str; leading = optional)write
sheets_to_jsonsheet (str, default "Sheet1"), max_rows (int)read
sheets_infoโ€”none (works without auth; richer when connected)
sheets_batch_updatereads (list of range strings), writes (list of {range, data})read / write

value_render accepts the Google Sheets values:FORMATTED_VALUE, UNFORMATTED_VALUE, or FORMULA.

Output

The Actor pushes records to the default dataset:

  1. mcp_server_info โ€” server name/version, the tool catalog, whether auth and the spreadsheet succeeded, and a capabilities map.
  2. tool_result (one per tool call) โ€” { "type": "tool_result", "tool": <name>, "arguments": {...}, "result": {...} }.
  3. session_stats โ€” counts of operations, reads, writes, and errors.

Each tool's result includes success: true|false. On failure it includes an error string (and the tool name) instead of throwing.

Example output (for the input above)

{
"type": "tool_result",
"tool": "sheets_read_range",
"arguments": { "range": "Sheet1!A1:D10", "include_headers": true },
"result": {
"success": true,
"range": "Sheet1!A1:D10",
"row_count": 9,
"headers": ["Name", "Email", "Age", "City"],
"data": [["Alice", "a@x.com", "30", "NYC"], "..."],
"records": [{ "Name": "Alice", "Email": "a@x.com", "Age": "30", "City": "NYC" }, "..."]
}
}

Setup (service account)

  1. Create a Google Cloud project.
  2. Enable the Google Sheets API for that project.
  3. Create a service account and download its JSON key.
  4. Share your spreadsheet with the service account's email (found as client_email in the key) โ€” give Editor access for writes.
  5. Paste the JSON key into credentialsJson (raw or base64).

For read-only access to a public sheet, you can instead supply an apiKey.

Limitations

  • Reads and writes use Google's standard value semantics (USER_ENTERED for writes, so strings like =A1+B1 become formulas and "5" becomes a number).
  • API key auth is read-only and only works on sheets the key can access (typically public ones); write tools will return a Google permission error.
  • The service account must be explicitly shared on each private spreadsheet; otherwise reads/writes fail with an access error.
  • sheets_delete_sheet refuses to delete the last remaining sheet tab.
  • Subject to Google Sheets API quotas and rate limits on your Google Cloud project.
  • This is a request/response Actor, not a long-lived MCP socket: each run authenticates, executes the requested tool call(s), and exits.

Errors and reliability

Invalid JSON credentials, a missing/garbled service-account key, an inaccessible spreadsheet, a malformed toolCall, or wrong tool arguments all produce a structured success: false error rather than crashing the run. This keeps the Actor healthy on Apify even when input is incomplete.

FAQ

Do I need a Google account? Yes โ€” you need either a Google service account (for read/write) or a Google API key (read-only). Both are free to create in Google Cloud. See "Setup" above.

Why a service account instead of signing in with OAuth? A service account lets the Actor run unattended (scheduled, headless) without an interactive login. You simply share the target spreadsheet with the service account's email.

Is my data or credentials exposed? Credentials are passed as secret inputs and used only to call Google's API for your run. There's no mock layer โ€” the Actor talks directly to your spreadsheet and returns exactly what Google returns.

Read-only vs. read/write โ€” which do I need? Use an apiKey for read-only access to public sheets. Use a credentialsJson service-account key (shared on the sheet with Editor access) for any write, append, create, delete, or formula-set operation.

Can it run on a schedule? Yes. Pair it with an Apify Schedule to append rows or sync data on a recurring basis.

What about Google's rate limits? Calls count against your Google Cloud project's Sheets API quota. For heavy use, batch with sheets_batch_update and stagger scheduled runs.

Can it work across multiple spreadsheets? Each run targets one spreadsheet (spreadsheetId/spreadsheetUrl). Run it once per sheet โ€” for example via several scheduled tasks โ€” to cover more than one.