This MCP server integrates with your Google Drive and Google Sheets, to enable creating and modifying spreadsheets.
This MCP server integrates with your Google Drive and Google Sheets, to enable creating and modifying spreadsheets.
A Model Context Protocol server for interacting with Google Sheets. This server provides tools to create, read, update, and manage spreadsheets through the Google Sheets API.
get_sheet_data
spreadsheet_id
(string): The ID of the spreadsheet (found in the URL)sheet
(string): The name of the sheetrange
(optional string): Cell range in A1 notation (e.g., 'A1:C10')update_cells
spreadsheet_id
(string): The ID of the spreadsheetsheet
(string): The name of the sheetrange
(string): Cell range in A1 notationdata
(2D array): Values to updatebatch_update_cells
spreadsheet_id
(string): The ID of the spreadsheetsheet
(string): The name of the sheetranges
(object): Dictionary mapping range strings to 2D arrays of valueslist_sheets
spreadsheet_id
(string): The ID of the spreadsheetlist_spreadsheets
create_spreadsheet
title
(string): The title of the new spreadsheetcreate_sheet
spreadsheet_id
(string): The ID of the spreadsheettitle
(string): The title for the new sheetAdditional tools: add_rows
, add_columns
, copy_sheet
, rename_sheet
spreadsheet://{spreadsheet_id}/info
The server requires some setup in Google Cloud Platform and choosing an authentication method before running.
You can use one of two authentication methods:
Service accounts provide headless authentication without browser prompts, ideal for automated or server environments. Benefits include:
Setup steps:
Create a service account:
Create a dedicated folder in Google Drive to share with the service account:
https://drive.google.com/drive/folders/FOLDER_ID_HERE
client_email
)Set these environment variables:
SERVICE_ACCOUNT_PATH
: Path to service account JSON key fileDRIVE_FOLDER_ID
: ID of the Google Drive folder shared with the service accountThis method requires browser interaction for the first-time setup, suitable for personal use or development.
Configure OAuth for your project:
credentials.json
Set these environment variables:
CREDENTIALS_PATH
: Path to the downloaded OAuth credentials file (default: credentials.json
)TOKEN_PATH
: Path where the authentication token will be stored (default: token.json
)For Linux/Mac:
# For service account authentication (recommended)
export SERVICE_ACCOUNT_PATH=/path/to/your/service-account-key.json
export DRIVE_FOLDER_ID=your_shared_folder_id_here
# OR for OAuth authentication
export CREDENTIALS_PATH=/path/to/your/credentials.json
export TOKEN_PATH=/path/to/your/token.json
For Windows:
# For service account authentication (recommended)
set SERVICE_ACCOUNT_PATH=C:\path\to\your\service-account-key.json
set DRIVE_FOLDER_ID=your_shared_folder_id_here
# OR for OAuth authentication
set CREDENTIALS_PATH=C:\path\to\your\credentials.json
set TOKEN_PATH=C:\path\to\your\token.json
When using uvx
, you can run the server directly without installation:
# Set environment variables first, then run the server
uvx mcp-google-sheets
If you want to modify and develop the server:
git clone https://github.com/yourusername/mcp-google-sheets.git
cd mcp-google-sheets
# Set environment variables first, then run
uv run mcp-google-sheets
The server automatically selects the authentication method based on environment variables:
With service account authentication, no browser interaction is needed, and the server will directly operate on spreadsheets in the shared Google Drive folder.
With OAuth authentication, the first time you use the server, it will open a browser window to authenticate with your Google account. After authentication, a token will be saved in the location specified by the TOKEN_PATH
environment variable.
Add this to your claude_desktop_config.json
:
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets"],
"env": {
"SERVICE_ACCOUNT_PATH": "/path/to/your/service-account-key.json",
"DRIVE_FOLDER_ID": "your_shared_folder_id_here"
}
}
}
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets"],
"env": {
"CREDENTIALS_PATH": "/path/to/your/credentials.json",
"TOKEN_PATH": "/path/to/your/token.json"
}
}
}
"mcpServers": {
"mcp-google-sheets": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-google-sheets",
"run",
"mcp-google-sheets"
],
"env": {
"SERVICE_ACCOUNT_PATH": "/path/to/mcp-google-sheets/service-account-key.json",
"DRIVE_FOLDER_ID": "your_shared_folder_id_here"
// OR for OAuth:
// "CREDENTIALS_PATH": "/path/to/mcp-google-sheets/credentials.json",
// "TOKEN_PATH": "/path/to/mcp-google-sheets/token.json"
},
"disabled": false
}
}
Once the MCP server is connected to Claude, you can use prompts like these:
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
This project was inspired by the kazz187/mcp-google-spreadsheet repository and ported to Python using FastMCP.