Integrates with Google Cloud APIs using OAuth2 authentication to access Google Sheets and Drive services.
Enables searching and managing Google Sheets files within Google Drive, providing Drive-level operations for spreadsheet management.
Provides comprehensive tools for managing Google Sheets including creating, reading, updating, and deleting spreadsheets and worksheets, with support for data operations, formatting, charts, conditional formatting, and SQL-like queries.
Google Sheets MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with Google Sheets and Google Drive using OAuth2 authentication.
Features
- Authentication: OAuth2-based authentication with Google APIs
- Google Sheets: Create, read, update, and delete spreadsheets and worksheets
- Data Operations: Batch operations and data filtering
- Formatting: Cell formatting, charts, and conditional formatting
Prerequisites
- Python 3.12+
- UV package manager
- Google Cloud Project with Google Sheets API enabled
- OAuth2 credentials from Google Cloud Console
Quick Start
1. Clone and Setup
2. Authentication Setup
- Download your
credentials.json
from Google Cloud Console - Place it in the project directory
- Run authentication:
- Follow the prompts to complete OAuth2 authentication
3. Start the MCP Server
4. Test with MCP Inspector
Project Structure
Available Tools
Spreadsheet Management
list_sheets
- List all Google Sheets in your Drivecreate_google_sheet
- Create a new Google Sheetdelete_spreadsheet
- Delete a Google Sheetget_spreadsheet_info
- Get spreadsheet metadata
Worksheet Management
add_worksheet
- Add a new worksheet to a spreadsheetdelete_sheet
- Delete a worksheet from a spreadsheetget_sheet_names
- Get all worksheet namesfind_worksheet_by_title
- Find worksheet by exact titlecopy_sheet_to_another_spreadsheet
- Copy sheet between spreadsheets
Data Operations
get_cell_data
- Get data from specific cellsupdate_sheet_data
- Update cell dataappend_values_to_spreadsheet
- Append data to spreadsheetbatch_update_by_filter
- Update values by data filterexecute_sql_query
- Execute SQL-like queries on sheets
Data Filtering
get_spreadsheet_by_data_filter
- Get data using filtersbatch_get_spreadsheet_values_by_data_filter
- Get values by data filterbatch_clear_spreadsheet_values
- Clear multiple rangesbatch_clear_values_by_data_filter
- Clear values by data filter
Table Operations
list_tables
- List all tables in a spreadsheetget_table_schema
- Get table structure and schemacreate_sheet_from_json
- Create sheet from JSON data
Formatting and Charts
format_cell
- Apply cell formattingcreate_chart
- Create charts in sheetsset_basic_filter
- Set basic filtersclear_basic_filter
- Clear basic filters
Dimension Management
append_dimension
- Add rows/columnsinsert_dimension
- Insert rows/columns at specific positionsdelete_dimension
- Delete rows/columnscreate_spreadsheet_column
- Create new columnscreate_spreadsheet_row
- Create new rows
Developer Metadata
create_developer_metadata
- Create metadatasearch_developer_metadata
- Search metadatadelete_developer_metadata
- Delete metadata
Properties Management
update_sheet_properties
- Update worksheet propertiesupdate_spreadsheet_properties
- Update spreadsheet properties
Drive Operations
search_spreadsheets
- Search for spreadsheets in Drive
Development
Adding Dependencies
Testing
Troubleshooting
Common Issues
- "Credentials file not found"
- Ensure
credentials.json
exists in project directory - Run
uv run authenticate.py
to set up authentication
- Ensure
- "Token file not found"
- Run
uv run authenticate.py
to create a new token
- Run
- "Module not found"
- Run
uv sync
to install dependencies
- Run
- "Authentication required"
- Run
uv run authenticate.py
to set up authentication
- Run
UV-Specific Issues
- "Command not found: uv"
- Install UV:
curl -LsSf https://astral.sh/uv/install.sh | sh
- Restart your terminal
- Install UV:
- "Failed to install dependencies"
- Clear UV cache:
uv cache clean
- Reinstall:
uv sync --reinstall
- Clear UV cache:
Security Notes
- Never commit
credentials.json
or.token.json
to version control - Keep your OAuth2 credentials secure
- Tokens are automatically refreshed when needed
Support
For issues or questions:
- Check the troubleshooting section above
- Verify UV is properly installed and dependencies are synced
- Ensure Google Sheets API is enabled in your Google Cloud Project
- Check that your OAuth2 credentials have the correct scopes
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables comprehensive interaction with Google Sheets and Google Drive through OAuth2 authentication. Supports spreadsheet creation, data manipulation, formatting, chart creation, and advanced operations like SQL queries and batch updates.
Related MCP Servers
- -securityAlicense-qualityEnables integration with Google Drive for listing, reading, and searching over files, supporting various file types with automatic export for Google Workspace files.Last updated -1,05146MIT License
- -securityAlicense-qualityProvides authenticated access to Google Workspace APIs with a focus on Gmail operations and planned Calendar support, featuring secure OAuth authentication and multi-account management with detailed error handling.Last updated -90MIT License
- -securityAlicense-qualityIntegrates with Google Drive to enable listing, searching, and reading files, plus reading and writing to Google Sheets.Last updated -633184MIT License
- -securityFlicense-qualityIntegrates with Google Drive to enable listing, reading, and searching over files, with automatic export of Google Workspace documents to appropriate formats.Last updated -1,051