- Home
- MCP servers
- Google Sheets
Google Sheets
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"hgdeveloper13-kilocode-mcp-google-workspace": {
"command": "python",
"args": [
"server.py"
],
"env": {
"DRIVE_FOLDER_ID": "Drive folder ID for search",
"CREDENTIALS_CONFIG": "BASE64-encoded JSON service account",
"ENABLE_CREATE_TOOLS": "true or false",
"GOOGLE_APPLICATION_CREDENTIALS": "path to service account key file (export as shown)"
}
}
}
}You can automate and extend your Google Workspace work with the Google Sheets MCP Server, enabling programmatic access to Google Sheets, Docs, and Drive via MCP clients. Use it to read and update data, manage documents, and search or share files seamlessly from your applications.
How to use
This server exposes a set of tools that integrate with MCP clients to interact with Google Sheets, Docs, and Drive. Start the local server and connect your MCP client to the provided command. When using a client, specify the server by name and run the documented tools to perform actions such as reading sheet data, updating cells, creating or renaming sheets, extracting document text, and searching Drive.
How to install
Prerequisites you need before installation: Python 3.8+ and an active internet connection.
Clone the repository, set up a virtual environment, and install dependencies.
# Clone the repository
git clone https://github.com/yourusername/mcp-google-sheets.git
cd mcp-google-sheets
# Create a virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
Configuration and running
You configure authentication and environment variables to enable Google API access and runtime behavior.
Set the credentials path for your service account or OAuth flow. The recommended method uses a service account and requires a key file. Export the path in your environment as follows.
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
Run the server
Start the MCP server locally using Python. This launches the server process that MCP clients can communicate with.
python server.py
Authentication methods
You can authenticate using either a service account or OAuth 2.0. The service account method is the recommended approach for unattended or server-to-server interactions.
Service Account steps involve creating a service account in Google Cloud Console, downloading the key file, and granting access to the necessary Sheets and Drive resources.
OAuth 2.0 steps involve creating OAuth credentials, downloading credentials.json, authorizing on first run, and storing the token in token.json.
Environment variables
Define the following environment variables to configure the server behavior and Google access.
| Variable | Description | Default |
|----------|-------------|---------|
| GOOGLE_APPLICATION_CREDENTIALS | Path to the service account key file | service-account-key.json |
| CREDENTIALS_CONFIG | Base64-encoded JSON service account | - |
| DRIVE_FOLDER_ID | Drive folder ID to search for spreadsheets | - |
| ENABLE_CREATE_TOOLS | Enable creation tools (true/false) | false |
Usage with MCP clients
To connect an MCP client, provide the server connection details as shown in the example below. This config connects a client named google-sheets to the local Python server.
{
"mcpServers": {
"google-sheets": {
"command": "python",
"args": ["server.py"]
}
}
}
Available tools
get_sheet_data
Retrieve data from a specified Google Sheet range.
get_sheet_formulas
Fetch formulas from cells within a sheet.
update_cells
Update values in one or more cells.
batch_update_cells
Perform batch updates across multiple ranges in a sheet.
add_rows
Insert new rows into a sheet.
add_columns
Insert new columns into a sheet.
list_sheets
List and enumerate sheets within a spreadsheet.
copy_sheet
Copy an existing sheet to a new sheet.
rename_sheet
Rename an existing sheet.
delete_sheet
Delete a sheet from a spreadsheet.
list_spreadsheets
List spreadsheets accessible in Drive.
share_spreadsheet
Grant access to a spreadsheet for users or groups.
get_doc_content
Retrieve the full content of a Google Doc.
get_doc_text
Extract plain text from a Google Doc.
search_drive_files
Search files and documents in Google Drive.