This MCP server integrates with your Google Drive and Google Sheets, enabling you to create and modify spreadsheets programmatically.
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 sheet.range
(optional string): Cell range in A1 notation (e.g., 'A1:C10').Returns: A 2D array of the sheet data.
update_cells
spreadsheet_id
(string): The ID of the spreadsheet.sheet
(string): The name of the sheet.range
(string): Cell range in A1 notation.data
(2D array): Values to update.Returns: Result of the update operation.
batch_update_cells
spreadsheet_id
(string): The ID of the spreadsheet.sheet
(string): The name of the sheet.ranges
(object): Dictionary mapping range strings to 2D arrays of values.Returns: Result of the batch update operation.
list_sheets
spreadsheet_id
(string): The ID of the spreadsheet.Returns: List of sheet names.
list_spreadsheets
Note: If using service account authentication, this will list spreadsheets in the shared folder.
create_spreadsheet
title
(string): The title of the new spreadsheet.Note: When using service account authentication with a configured folder ID, the spreadsheet will be created in that folder.
create_sheet
spreadsheet_id
(string): The ID of the spreadsheet.title
(string): The title for the new sheet.Returns: Information about the newly created sheet.
Additional 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 and download a JSON key file.
Create a dedicated folder in Google Drive to share with the service account:
https://drive.google.com/drive/folders/FOLDER_ID_HERE
.client_email
).Give it "Editor" access.
Set these environment variables:
SERVICE_ACCOUNT_PATH
: Path to service account JSON key file.DRIVE_FOLDER_ID
: ID of the Google Drive folder shared with the service account.This method requires browser interaction for the first-time setup, suitable for personal use or development.
Download the credentials JSON file and save it as 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
:
Using uvx with service account authentication (recommended):
"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"
}
}
}
Using uvx with OAuth authentication:
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets"],
"env": {
"CREDENTIALS_PATH": "/path/to/your/credentials.json",
"TOKEN_PATH": "/path/to/your/token.json"
}
}
}
For development:
"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.
No description, website, or topics provided.
No releases published.
No packages published.