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.
mcp-google-sheets
ServerUnlock the power of Large Language Models (LLMs) by connecting them directly to your Google Sheets data with the mcp-google-sheets
server. This Model Context Protocol (MCP) server acts as a bridge, enabling your LLM applications to create, read, update, and manage spreadsheets effortlessly. Imagine AI-powered workflows that automatically analyze data, generate reports, or even populate spreadsheets based on natural language instructions.
The mcp-google-sheets
server exposes a suite of powerful tools, each designed to facilitate specific interactions with your Google Sheets data:
get_sheet_data
: Extracts data from a specified sheet within a Google Spreadsheet.
spreadsheet_id
(string, the unique identifier in the URL), sheet
(string, the sheet name), and an optional range
(string, A1 notation like 'A1:C10').update_cells
: Modifies cell values within a Google Spreadsheet.
spreadsheet_id
(string), sheet
(string), range
(string, A1 notation), and data
(2D array, the new values).batch_update_cells
: Efficiently updates multiple ranges within a Google Spreadsheet in a single operation.
spreadsheet_id
(string), sheet
(string), and ranges
(object, a dictionary mapping range strings to 2D arrays of values).list_sheets
: Retrieves a list of all sheet names within a Google Spreadsheet.
spreadsheet_id
(string).list_spreadsheets
: Lists all spreadsheets accessible within the configured Google Drive folder.
create_spreadsheet
: Creates a new Google Spreadsheet with a specified title.
title
(string, the desired spreadsheet title).create_sheet
: Adds a new sheet (tab) to an existing Google Spreadsheet.
spreadsheet_id
(string), title
(string, the desired sheet title).Additional Tools: The server also provides tools for more advanced operations, including add_rows
, add_columns
, copy_sheet
, and rename_sheet
, offering comprehensive control over your spreadsheets.
spreadsheet://{spreadsheet_id}/info
: Retrieves basic information about a Google Spreadsheet.
Before running the mcp-google-sheets
server, you'll need to configure access to your Google Sheets data through the Google Cloud Platform and choose an authentication method.
The mcp-google-sheets
server supports two authentication methods, each suited for different use cases:
Service accounts provide a secure and non-interactive way to authenticate, ideal for automated processes and server environments.
Benefits:
Setup:
SERVICE_ACCOUNT_PATH
: Path to the service account JSON key file.DRIVE_FOLDER_ID
: ID of the Google Drive folder shared with the service account.OAuth 2.0 requires browser interaction for initial setup, making it suitable for personal use and development environments.
Setup:
credentials.json
.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
).Linux/Mac:
# Service Account Authentication export SERVICE_ACCOUNT_PATH=/path/to/your/service-account-key.json export DRIVE_FOLDER_ID=your_shared_folder_id_here # OR OAuth Authentication export CREDENTIALS_PATH=/path/to/your/credentials.json export TOKEN_PATH=/path/to/your/token.json
Windows:
# Service Account Authentication set SERVICE_ACCOUNT_PATH=C:\path\to\your\service-account-key.json set DRIVE_FOLDER_ID=your_shared_folder_id_here # OR OAuth Authentication set CREDENTIALS_PATH=C:\path\to\your\credentials.json set TOKEN_PATH=C:\path\to\your\token.json
You can run the mcp-google-sheets
server using two methods:
uvx
(Recommended for General Use)uvx
allows you to run the server directly without installation, simplifying the process.
# Set environment variables first, then run the server uvx mcp-google-sheets
If you plan to modify the server's code:
Clone the Repository:
git clone https://github.com/yourusername/mcp-google-sheets.git cd mcp-google-sheets
Run with uv
:
# Set environment variables first, then run uv run mcp-google-sheets
The server intelligently selects the authentication method based on the configured environment variables:
With service account authentication, the server operates directly on spreadsheets within the shared Google Drive folder without requiring browser interaction.
With OAuth authentication, the first time you run the server, it will open a browser window to authenticate with your Google account. After successful authentication, a token will be saved in the location specified by the TOKEN_PATH
environment variable.
To integrate the mcp-google-sheets
server with Claude Desktop, add the following configuration to your claude_desktop_config.json
file:
"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" } } }
Note: Adjust the paths and folder ID to match your specific configuration. For OAuth, replace the SERVICE_ACCOUNT_PATH
and DRIVE_FOLDER_ID
with CREDENTIALS_PATH
and TOKEN_PATH
respectively.
Once the MCP server is connected to Claude, you can use natural language prompts to interact with your Google Sheets data:
These prompts demonstrate the power of combining LLMs with the mcp-google-sheets
server, enabling you to automate spreadsheet tasks and gain deeper insights from your data.
📇 🏠 🍎 Allows to read notes and tags for the Bear Note taking app, through a direct integration with Bear's sqlitedb.
📇 An MCP server for basic local taskwarrior usage (add, update, remove tasks)
📇 🏠 An MCP server to list and launch applications on MacOS
🐍 ☁️ A Model Context Protocol (MCP) server that integrates with Notion's API to manage personal todo lists efficiently.