communitystdio

Google Sheets MCP Server

Read and write Google Sheets data from Claude Code or Cursor after a one-time OAuth2 or service account setup.

Updated: April 15, 2026

Install

npx mcp-google-sheets
~/.claude/settings.json
{
  "mcpServers": {
    "google-sheets-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-google-sheets"
      ],
      "env": {
        "GOOGLE_CREDENTIALS_FILE": "/path/to/credentials.json"
      }
    }
  }
}

Capabilities

  • + Read cell ranges and entire sheets with A1 notation
  • + Write data to specific cells with typed values
  • + Append rows to an existing sheet or named range
  • + List all sheets in a spreadsheet with tab names and IDs
  • + Get spreadsheet metadata including title, owner, and last modified

Limitations

  • - Requires OAuth2 consent flow or a service account with sheet share
  • - No formula execution via MCP; values come back as last-computed results
  • - Chart data is read-only; you cannot create or edit charts
  • - Large sheets (50k+ rows) are slow and often time out on full-range reads

Google Sheets MCP server setup for Claude Code and Cursor

Quick answer: The Google Sheets MCP server wraps the Google Sheets API as MCP tools for Claude Code and Cursor. Drop in the env vars, run one npx command, and the editor can reach the service directly. Setup takes about 10 minutes, tested on mcp-google-sheets@0.5.0 on April 15, 2026.

Google Sheets is the spreadsheet many teams use as a lightweight database. The MCP server wraps the Sheets v4 API to expose read and write tools. Without an MCP connection, working with Google Sheets means flipping between the editor and the web UI - copying IDs, pasting results, losing context. The MCP server removes that loop. Claude can fetch the data itself, reason about it, and write changes back without you switching tabs.

This guide covers install, config for both editors, prompt patterns that actually work, and the places where the API will bite back.

What this server does

The server speaks MCP over stdio and wraps the standard Google Sheets SDK. The tool surface is grouped into these sets:

  • Read: read_range, read_sheet, get_metadata
  • Write: write_range, append_row, update_cell
  • Schema: list_sheets, get_sheet_properties

Authentication uses GOOGLE_CREDENTIALS_FILE. The server holds credentials in process memory for the life of the subprocess. Nothing is written to disk by the server itself. If you rotate the credential, restart the MCP server and the new value takes effect immediately.

The server does not implement a local cache. Every tool call is a fresh round trip. For most workflows this is fine - round trip times are 100-400 ms - but it adds up on heavy batch jobs. For those, prefer the native SDK in a script.

Installing the server

The package ships on npm as mcp-google-sheets. The npx -y prefix fetches on first launch and caches the binary for subsequent runs. Cold pull is typically 3-8 MB depending on the SDK footprint and lands in 2-4 seconds.

Before touching editor config, get your credentials ready:

  1. Open https://console.cloud.google.com and create or select a project
  2. Enable the Google Sheets API and the Google Drive API
  3. Choose one path: OAuth2 desktop app (download credentials.json, run an auth helper, get token.json), or a Service Account (download the service-account JSON key)
  4. For Service Account, share each target spreadsheet with the service account email (ends in iam.gserviceaccount.com)

Keep the credential values out of any file you commit. The rest of this guide assumes they live in your shell profile or a .envrc managed by direnv.

Configuring for Claude Code

Claude Code reads MCP servers from ~/.claude/mcp.json or a per-project .mcp.json. Add a gsheets entry:

{
  "mcpServers": {
    "gsheets": {
      "command": "npx",
      "args": ["-y", "mcp-google-sheets"],
      "env": {
        "GOOGLE_CREDENTIALS_FILE": "/path/to/credentials.json"
      }
    }
  }
}

Restart Claude Code, then run /mcp in a session to confirm Google Sheets is attached. Call a read-only tool as a smoke test before any write operations. If the first call returns real data, the auth is working and you can widen the prompt scope.

For team projects, commit a placeholder version of .mcp.json with ${VAR_NAME} inside the env values and let each developer provide the real credential via their shell. Claude Code expands env vars when it spawns the subprocess.

Configuring for Cursor

Cursor uses the same MCP spec and reads from ~/.cursor/mcp.json. The config is identical to Claude Code:

{
  "mcpServers": {
    "gsheets": {
      "command": "npx",
      "args": ["-y", "mcp-google-sheets"],
      "env": {
        "GOOGLE_CREDENTIALS_FILE": "/path/to/credentials.json"
      }
    }
  }
}

Open Cursor settings, navigate to the MCP tab, and toggle the server on. Cursor spawns the subprocess lazily on the first tool call. Expect 2-4 seconds of cold start and 150-500 ms per subsequent call depending on network latency to the upstream API.

If the Cursor UI shows the server as red, click the refresh icon and watch the error log. Most failures at this stage are a missing env var or a wrong file path in the credential config.

Example prompts and workflows

A few prompts that work reliably once the server is attached:

  • "Read the range A1:E100 from sheet Budget in spreadsheet ID 1xxx and show as a table."
  • "Append a row to sheet Expenses with values 2026-04-15, Coffee, 4.50."
  • "List every sheet tab in spreadsheet ID 1xxx and count the rows in each."
  • "Update cell B5 in sheet Q1 to the value Closed."
  • "Read the full Contacts sheet and show every row where the status column is pending."

The model will chain calls. A reporting flow usually runs list_sheets to discover tabs, then read_range to pull the data, then filters or aggregates in the prompt. Always pass the spreadsheet ID explicitly - the 44-character ID in the URL is the canonical reference; titles change and break lookups.

One pattern that saves calls: narrow the scope up front. Instead of asking Claude to list every record and then filter, include the filter in the first prompt. The tool returns less data, the response is faster, and the model has less noise to reason through.

Troubleshooting

Tool call returns 401. Token expired. For OAuth2 setups, re-run the auth helper. For Service Account, confirm the credentials JSON file path is correct and readable.

Tool call returns 403. The spreadsheet is not shared with the service account. Share the sheet with the service account email and grant Editor role.

Read range returns fewer rows than expected. Trailing empty cells are omitted by default. Pass valueRenderOption=FORMATTED_VALUE and majorDimension=ROWS explicitly, or widen the A1 range.

Write call succeeds but value does not appear. A filter or hidden row is intercepting the write. Check the target sheet in the web UI and remove filters, or write to a range the filter covers.

Tool call returns 429. Sheets API has a per-minute quota of 60 read and 60 write per user. For batch work, use batchUpdate instead of multiple single calls.

Server fails with ENOENT. npx is not on PATH in the env the editor inherits. On macOS, launch Claude Code or Cursor from a terminal so it inherits your shell env, or put the absolute path to npx in the command field.

Subprocess keeps restarting. The MCP transport is strict about newlines on stdio. If the server logs to stdout, those lines get treated as MCP messages and crash the client. Make sure any logging goes to stderr only (most well-built servers already do this).

Alternatives

A few options if the Google Sheets server does not fit your setup:

  • airtable-mcp targets Airtable for teams that prefer its typed field model.
  • excel-mcp works with Excel files locally for scenarios that do not need cloud sync.
  • notion-mcp covers Notion databases for teams running their spreadsheets inside Notion pages.

The MCP server pays off when ops, finance, or marketing teams keep their living data in Sheets and Claude needs to read, summarize, or append without a context switch.

Performance notes and hardening

Steady-state call latency lands in the 150-500 ms range for most tools. For latency-sensitive workflows, place the editor close to the upstream API region - a Claude Code session in us-east-1 calling an EU-only endpoint will see 120+ ms of extra RTT on every tool call.

For production credentials, prefer scoped tokens over root credentials. Most services expose fine-grained permission models; use them. A token that can only read is strictly safer than one that can write, and costs nothing to rotate.

Log review is easier if you redirect MCP subprocess stderr to a file. Most editors do this by default, but not all surface the log path. On macOS, check ~/Library/Logs/Claude/ or the Cursor equivalent.

The Google Sheets MCP server is the right default for any workflow that already touches Google Sheets regularly. A few minutes of setup replaces hours of copy-paste between the editor and the service's web UI. Start with a read-only credential scoped to a single resource, then widen scopes after you trust the prompt patterns your team develops.

Guides

Frequently asked questions

Should I use OAuth2 or a Service Account?

Service Account for automation and shared team workflows. OAuth2 for personal use when you want Claude to touch only sheets you own. Service accounts cannot access a sheet until it is explicitly shared with the account email.

How do I find a spreadsheet ID?

It is the 44-character string in the URL between `/d/` and `/edit`. For example `https://docs.google.com/spreadsheets/d/1A2B3C.../edit` gives you `1A2B3C...`. Copy that exact string into your prompt.

Can it read cell formulas or only values?

By default, the server returns computed values. To see the raw formula, pass `valueRenderOption=FORMULA` in the read call. The server does not evaluate formulas on your behalf - Google does.

Does it work with Google Workspace domain-restricted sheets?

Yes for OAuth2 if your workspace allows personal OAuth consent for Sheets. Some admin-managed workspaces block it; ask your admin or use a Service Account with sharing.

How fast is it on large sheets?

A 5,000-row read takes about 1-2 seconds. A 50,000-row read takes 10-15 seconds and often hits timeouts. For big data, move it to a real database and point Claude there instead.

Can I write formulas through the server?

Yes. Pass the formula as a string starting with `=`, like `=SUM(A1:A10)`. Sheets evaluates the formula on write and the next read returns the computed value. Be careful with formula-generated prompts - a bad formula can overwrite important data.