Google Sheets MCP server

Integrates with Google Drive and Google Sheets to create, read, update, and manage spreadsheets with support for both OAuth and service account authentication methods.
Back to servers
Setup instructions
Provider
Xing Wu
Release date
Mar 22, 2025
Language
Python
Package
Stats
10.6K downloads
208 stars

This Python-based MCP server acts as a bridge between AI assistants and Google Sheets, enabling powerful spreadsheet operations through a defined set of tools. It lets you query, create, and modify spreadsheets programmatically.

Prerequisites

Before using this server, you must set up Google Cloud Platform credentials:

  1. Create or select a GCP project in the Google Cloud Console
  2. Enable both the Google Sheets API and Google Drive API
  3. Configure authentication credentials (service account recommended)

Installation and Setup

Quick Start with uvx

  1. Install uv (which includes uvx):

    # macOS / Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  2. Configure authentication (service account recommended):

    # Linux/macOS
    export SERVICE_ACCOUNT_PATH="/path/to/your/service-account-key.json"
    export DRIVE_FOLDER_ID="YOUR_DRIVE_FOLDER_ID"
    
    # Windows CMD
    set SERVICE_ACCOUNT_PATH="C:\path\to\your\service-account-key.json"
    set DRIVE_FOLDER_ID="YOUR_DRIVE_FOLDER_ID"
    
    # Windows PowerShell
    $env:SERVICE_ACCOUNT_PATH = "C:\path\to\your\service-account-key.json"
    $env:DRIVE_FOLDER_ID = "YOUR_DRIVE_FOLDER_ID"
    
  3. Run the server:

    uvx mcp-google-sheets@latest
    

Authentication Options

Service Account (Recommended)

  1. Create a service account in GCP Console > "IAM & Admin" > "Service Accounts"
  2. Grant Editor role and create/download a JSON key file
  3. Create a Google Drive folder and share it with the service account email
  4. Set environment variables:
    export SERVICE_ACCOUNT_PATH="/path/to/service-account-key.json"
    export DRIVE_FOLDER_ID="your_folder_id_from_url"
    

OAuth 2.0

  1. Configure OAuth consent screen in GCP Console
  2. Create OAuth client ID for Desktop app
  3. Download the JSON credentials file
  4. Set environment variables:
    export CREDENTIALS_PATH="/path/to/credentials.json"
    export TOKEN_PATH="/path/to/token.json"
    

Direct Credential Injection

Instead of file paths, provide Base64-encoded credentials:

export CREDENTIALS_CONFIG="ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb..."
export DRIVE_FOLDER_ID="your_folder_id" # If using service account

Usage with Claude Desktop

Add this configuration to your claude_desktop_config.json:

{
  "mcpServers": {
    "google-sheets": {
      "command": "uvx",
      "args": ["mcp-google-sheets@latest"],
      "env": {
        "SERVICE_ACCOUNT_PATH": "/full/path/to/your/service-account-key.json",
        "DRIVE_FOLDER_ID": "your_shared_folder_id_here"
      },
      "healthcheck_url": "http://localhost:8000/health"
    }
  }
}

Available Tools

The server provides these tools for interacting with Google Sheets:

Basic Spreadsheet Operations

  • list_spreadsheets: Lists available spreadsheets
  • create_spreadsheet: Creates a new spreadsheet with specified title
  • list_sheets: Lists all sheets within a spreadsheet
  • create_sheet: Adds a new sheet to a spreadsheet
  • share_spreadsheet: Shares a spreadsheet with specified users and roles

Data Operations

  • get_sheet_data: Reads data from a specified range
  • get_sheet_formulas: Reads formulas from a specified range
  • update_cells: Writes data to a specific range
  • batch_update_cells: Updates multiple ranges in one operation
  • add_rows: Appends rows to the end of a sheet
  • get_multiple_sheet_data: Fetches data from multiple ranges across spreadsheets
  • get_multiple_spreadsheet_summary: Gets titles, sheet names, headers, and first rows

Example Prompts

  • "List all spreadsheets I have access to."
  • "Create a new spreadsheet titled 'Sales Report 2024'."
  • "In my 'Budget' spreadsheet, get the data from Sheet1 range A1:E10."
  • "Add a new sheet named 'Summary' to the spreadsheet with ID 'abc123'."
  • "Update cell B2 to 'In Progress' in the 'Tasks' sheet."
  • "Append these rows to the 'Log' sheet: [['2024-07-31', 'Task Completed'], ['2024-08-01', 'New Task']]"

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "google-sheets" '{"command":"uvx","args":["mcp-google-sheets@latest"],"env":{"SERVICE_ACCOUNT_PATH":"/path/to/your/service-account-key.json","DRIVE_FOLDER_ID":"your_shared_folder_id_here"},"healthcheck_url":"http://localhost:8000/health"}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "google-sheets": {
            "command": "uvx",
            "args": [
                "mcp-google-sheets@latest"
            ],
            "env": {
                "SERVICE_ACCOUNT_PATH": "/path/to/your/service-account-key.json",
                "DRIVE_FOLDER_ID": "your_shared_folder_id_here"
            },
            "healthcheck_url": "http://localhost:8000/health"
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "google-sheets": {
            "command": "uvx",
            "args": [
                "mcp-google-sheets@latest"
            ],
            "env": {
                "SERVICE_ACCOUNT_PATH": "/path/to/your/service-account-key.json",
                "DRIVE_FOLDER_ID": "your_shared_folder_id_here"
            },
            "healthcheck_url": "http://localhost:8000/health"
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later