by xing5
Provides a bridge between MCP‑compatible clients and Google Sheets/Drive APIs, enabling creation, reading, updating, sharing, and batch operations on spreadsheets through a defined set of tools.
Mcp Google Sheets acts as an MCP server that connects any MCP‑compatible client (e.g., Claude Desktop) to the Google Sheets and Google Drive APIs. It exposes a collection of tools that let AI assistants manipulate spreadsheets—create new files, read data, write cells, manage sheets, share documents, and more—without requiring the client to handle Google authentication directly.
SERVICE_ACCOUNT_PATH
(or CREDENTIALS_CONFIG
, CREDENTIALS_PATH
, DRIVE_FOLDER_ID
, etc.) so the server can authenticate.uvx mcp-google-sheets@latest
(or run the package from source with uv run
).mcpServers
section.uvx
for quick start.Q: Do I need to install Python packages manually?
A: No. Using uvx
downloads and runs the latest package automatically. For development you can clone the repository and run it with uv
.
Q: Which authentication method should I choose? A: For server‑side or automation scenarios, a Service Account is recommended. For local interactive use, OAuth 2.0 works fine.
Q: What if I already have GOOGLE_APPLICATION_CREDENTIALS
set?
A: The server follows the standard credential discovery order and will use ADC automatically if no other variables are provided.
Q: Can I run the server on Windows?
A: Yes. Set the environment variables using set
or PowerShell syntax and launch with uvx
.
Q: How do I integrate with Claude Desktop?
A: Add the server definition to claude_desktop_config.json
under mcpServers
, specifying the command (uvx
or the full path) and the required environment variables.
mcp-google-sheets
is a Python-based MCP server that acts as a bridge between any MCP-compatible client (like Claude Desktop) and the Google Sheets API. It allows you to interact with your Google Spreadsheets using a defined set of tools, enabling powerful automation and data manipulation workflows driven by AI.
uvx
)Essentially the server runs in one line: uvx mcp-google-sheets@latest
.
This cmd will automatically download the latest code and run it. We recommend always using @latest
to ensure you have the newest version with the latest features and bug fixes.
☁️ Prerequisite: Google Cloud Setup
🐍 Install uv
uvx
is part of uv
, a fast Python package installer and resolver. Install it if you haven't already:
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or using pip:
# pip install uv
Follow instructions in the installer output to add uv
to your PATH if needed.🔑 Set Essential Environment Variables (Service Account Recommended)
# Replace with YOUR actual path and folder ID from the Google Setup step
export SERVICE_ACCOUNT_PATH="/path/to/your/service-account-key.json"
export DRIVE_FOLDER_ID="YOUR_DRIVE_FOLDER_ID"
set SERVICE_ACCOUNT_PATH="C:\path\to\your\service-account-key.json"
set DRIVE_FOLDER_ID="YOUR_DRIVE_FOLDER_ID"
$env:SERVICE_ACCOUNT_PATH = "C:\path\to\your\service-account-key.json"
$env:DRIVE_FOLDER_ID = "YOUR_DRIVE_FOLDER_ID"
CREDENTIALS_CONFIG
).🏃 Run the Server!
uvx
will automatically download and run the latest version of mcp-google-sheets
:
uvx mcp-google-sheets@latest
💡 Pro Tip: Always use
@latest
to ensure you get the newest version with bug fixes and features. Without@latest
,uvx
may use a cached older version.
🔌 Connect your MCP Client
You're ready! Start issuing commands via your MCP client.
uvx
(zero-install feel) or clone for development using uv
.This server exposes the following tools for interacting with Google Sheets:
(Input parameters are typically strings unless otherwise specified)
list_spreadsheets
: Lists spreadsheets in the configured Drive folder (Service Account) or accessible by the user (OAuth).
[{id: string, title: string}]
create_spreadsheet
: Creates a new spreadsheet.
title
(string): The desired title.spreadsheetId
.get_sheet_data
: Reads data from a range in a sheet.
spreadsheet_id
(string)sheet
(string): Name of the sheet.range
(optional string): A1 notation (e.g., 'A1:C10'
, 'Sheet1!B2:D'
). If omitted, reads the whole sheet.get_sheet_formulas
: Reads formulas from a range in a sheet.
spreadsheet_id
(string)sheet
(string): Name of the sheet.range
(optional string): A1 notation (e.g., 'A1:C10'
, 'Sheet1!B2:D'
). If omitted, reads the whole sheet.update_cells
: Writes data to a specific range. Overwrites existing data.
spreadsheet_id
(string)sheet
(string)range
(string): A1 notation.data
(2D array): Values to write.batch_update_cells
: Updates multiple ranges in one API call.
spreadsheet_id
(string)sheet
(string)ranges
(object): Dictionary mapping range strings (A1 notation) to 2D arrays of values { "A1:B2": [[1, 2], [3, 4]], "D5": [["Hello"]] }
.add_rows
: Appends rows to the end of a sheet (after the last row with data).
spreadsheet_id
(string)sheet
(string)data
(2D array): Rows to append.list_sheets
: Lists all sheet names within a spreadsheet.
spreadsheet_id
(string)["Sheet1", "Sheet2"]
.create_sheet
: Adds a new sheet (tab) to a spreadsheet.
spreadsheet_id
(string)title
(string): Name for the new sheet.get_multiple_sheet_data
: Fetches data from multiple ranges across potentially different spreadsheets in one call.
queries
(array of objects): Each object needs spreadsheet_id
, sheet
, and range
. [{spreadsheet_id: 'abc', sheet: 'Sheet1', range: 'A1:B2'}, ...]
.data
or an error
.get_multiple_spreadsheet_summary
: Gets titles, sheet names, headers, and first few rows for multiple spreadsheets.
spreadsheet_ids
(array of strings)rows_to_fetch
(optional integer, default 5): How many rows (including header) to preview.share_spreadsheet
: Shares a spreadsheet with specified users/emails and roles.
spreadsheet_id
(string)recipients
(array of objects): [{email_address: 'user@example.com', role: 'writer'}, ...]
. Roles: reader
, commenter
, writer
.send_notification
(optional boolean, default True): Send email notifications.successes
and failures
lists.add_columns
: Adds columns to a sheet. (Verify parameters if implemented)copy_sheet
: Duplicates a sheet within a spreadsheet. (Verify parameters if implemented)rename_sheet
: Renames an existing sheet. (Verify parameters if implemented)MCP Resources:
spreadsheet://{spreadsheet_id}/info
: Get basic metadata about a Google Spreadsheet.
This setup is required before running the server.
Google Sheets API
Google Drive API
The server needs credentials to access Google APIs. Choose one method:
mcp-sheets-service
).Editor
role for broad access, or more granular roles (like roles/drive.file
and specific Sheets roles) for stricter permissions.https://drive.google.com/drive/folders/THIS_IS_THE_FOLDER_ID
.client_email
).SERVICE_ACCOUNT_PATH
: Full path to the downloaded JSON key file.DRIVE_FOLDER_ID
: The ID of the shared Google Drive folder.
(See Ultra Quick Start for OS-specific examples).../auth/spreadsheets
, .../auth/drive
), add test users if needed.CREDENTIALS_PATH
: Path to the downloaded OAuth credentials JSON file (default: credentials.json
).TOKEN_PATH
: Path to store the user's refresh token after first login (default: token.json
). Must be writable.your_credentials.json
.base64 -w 0 your_credentials.json
$filePath = "C:\path\to\your_credentials.json"; # Use actual path
$bytes = [System.IO.File]::ReadAllBytes($filePath);
$base64 = [System.Convert]::ToBase64String($bytes);
$base64 # Copy this output
CREDENTIALS_CONFIG
: Set this variable to the full Base64 string you just generated.
# Example (Linux/macOS) - Use the actual string generated
export CREDENTIALS_CONFIG="ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb..."
gcloud auth application-default login
. No explicit credential files needed.GOOGLE_APPLICATION_CREDENTIALS
environment variable (path to service account key) - Google's standard variablegcloud auth application-default login
credentials (local development)gcloud auth application-default login
onceGOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
(Google's standard)Note: GOOGLE_APPLICATION_CREDENTIALS
is Google's official standard environment variable, while SERVICE_ACCOUNT_PATH
is specific to this MCP server. If you set GOOGLE_APPLICATION_CREDENTIALS
, ADC will find it automatically.
The server checks for credentials in this order:
CREDENTIALS_CONFIG
(Base64 content)SERVICE_ACCOUNT_PATH
(Path to Service Account JSON)CREDENTIALS_PATH
(Path to OAuth JSON) - triggers interactive flow if token is missing/expiredEnvironment Variable Summary:
Variable | Method(s) | Description | Default |
---|---|---|---|
SERVICE_ACCOUNT_PATH |
Service Account | Path to the Service Account JSON key file (MCP server specific). | - |
GOOGLE_APPLICATION_CREDENTIALS |
ADC | Path to service account key (Google's standard variable). | - |
DRIVE_FOLDER_ID |
Service Account | ID of the Google Drive folder shared with the Service Account. | - |
CREDENTIALS_PATH |
OAuth 2.0 | Path to the OAuth 2.0 Client ID JSON file. | credentials.json |
TOKEN_PATH |
OAuth 2.0 | Path to store the generated OAuth token. | token.json |
CREDENTIALS_CONFIG |
Service Account / OAuth 2.0 | Base64 encoded JSON string of credentials content. | - |
uvx
(Recommended for Users)As shown in the Ultra Quick Start, this is the easiest way. Set environment variables, then run:
uvx mcp-google-sheets@latest
uvx
handles fetching and running the package temporarily.
If you want to modify the code:
git clone https://github.com/yourusername/mcp-google-sheets.git && cd mcp-google-sheets
(Use actual URL)uv
: (Uses the local code)
uv run mcp-google-sheets
# Or via the script name if defined in pyproject.toml, e.g.:
# uv run start
Add the server config to claude_desktop_config.json
under mcpServers
. Choose the block matching your setup:
⚠️ Important Notes:
"/Users/yourusername/.local/bin/uvx"
instead of just "uvx"
{
"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"
}
}
}
}
🍎 macOS Note: If you get a spawn uvx ENOENT
error, use the full path to uvx
:
{
"mcpServers": {
"google-sheets": {
"command": "/Users/yourusername/.local/bin/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"
}
}
}
}
Replace yourusername
with your actual username.
{
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets@latest"],
"env": {
"CREDENTIALS_PATH": "/full/path/to/your/credentials.json",
"TOKEN_PATH": "/full/path/to/your/token.json"
}
}
}
}
Note: A browser may open for Google login on first use. Ensure TOKEN_PATH is writable.
🍎 macOS Note: If you get a spawn uvx ENOENT
error, replace "command": "uvx"
with "command": "/Users/yourusername/.local/bin/uvx"
(replace yourusername
with your actual username).
{
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets@latest"],
"env": {
"CREDENTIALS_CONFIG": "ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb3VudCIsCiAgInByb2plY3RfaWQiOiAi...",
"DRIVE_FOLDER_ID": "your_shared_folder_id_here"
}
}
}
}
Note: Paste the full Base64 string for CREDENTIALS_CONFIG. DRIVE_FOLDER_ID is still needed for Service Account folder context.
🍎 macOS Note: If you get a spawn uvx ENOENT
error, replace "command": "uvx"
with "command": "/Users/yourusername/.local/bin/uvx"
(replace yourusername
with your actual username).
Option 1: With GOOGLE_APPLICATION_CREDENTIALS
{
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets@latest"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
}
}
Option 2: With gcloud auth (no env vars needed)
{
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets@latest"],
"env": {}
}
}
}
Prerequisites: Run gcloud auth application-default login
first.
🍎 macOS Note: If you get a spawn uvx ENOENT
error, replace "command": "uvx"
with "command": "/Users/yourusername/.local/bin/uvx"
(replace yourusername
with your actual username).
{
"mcpServers": {
"mcp-google-sheets-local": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/your/mcp-google-sheets",
"mcp-google-sheets"
],
"env": {
"SERVICE_ACCOUNT_PATH": "/path/to/your/mcp-google-sheets/service_account.json",
"DRIVE_FOLDER_ID": "your_drive_folder_id_here"
}
}
}
}
Note: Use --directory
flag to specify the project path, and adjust paths to match your actual workspace location.
Once connected, try prompts like:
1aBcDeFgHiJkLmNoPqRsTuVwXyZ
."XYZ
: [['2024-07-31', 'Task A Completed'], ['2024-08-01', 'Task B Started']]
"team@example.com
as a reader and manager@example.com
as a writer. Don't send notifications."Contributions are welcome! Please open an issue to discuss bugs or feature requests. Pull requests are appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.