How to connect Google Sheets to Claude Code (full setup guide)
Feb 16, 2026
Step-by-step guide to connecting Google Sheets to Claude Code using the mcp-google-sheets MCP server. Choose between an automated one-command setup or a detailed manual walkthrough.
Why connect Google Sheets to Claude Code?
Claude Code is a powerful AI assistant that lives in your terminal. But by default, it can't access your Google Sheets. You'd have to download CSVs and feed them in manually. That's slow, error-prone, and breaks your flow.
By connecting Google Sheets directly to Claude Code via MCP (Model Context Protocol), you unlock the ability to read, write, search, and manipulate spreadsheets in real time, all from your terminal. No copy-pasting. No downloads. Just ask Claude to pull data from a sheet, update cells, or analyze your spreadsheet, and it happens instantly.
This guide walks you through the full setup using mcp-google-sheets, an open-source MCP server built by xing5.
What is MCP?
MCP (Model Context Protocol) is the standard way to extend Claude Code with external tools. Think of it like plugins. Each MCP server gives Claude new capabilities. The mcp-google-sheets server gives Claude the ability to interact with Google Sheets.
The MCP server runs locally on your machine. When Claude needs to read or write a spreadsheet, it sends a request to this local server, which then talks to the Google Sheets API on your behalf.
What you'll need
The setup requires a few tools and accounts. If you choose the guided setup (option 1 below), Claude will check for each of these automatically, install what's missing, and walk you through the rest. You don't need to set any of this up beforehand.
Claude Code installed and working (the CLI tool from Anthropic) -> this is the only thing you need to install yourself.
Python 3.8+ installed on your system (included in guided setup)
A Google account with access to the spreadsheets you want to use
A Google Cloud project (free to create, and the guided setup can help you make one)
Choose your setup method
There are two ways to set this up. Pick whichever suits you best:
Guided setup (recommended). Drop a single file into your project and let Claude walk you through everything interactively. It checks prerequisites, installs missing tools, authenticates with Google, enables APIs, and configures the MCP server. Fastest way to get started, and your whole team can reuse it.
Manual setup. Follow a detailed step-by-step guide and run each command yourself. Best if you want to understand exactly what's happening at every step.
Both methods produce the exact same result. The guided setup simply automates the manual steps.
Option 1: guided setup
This method uses a Claude Code custom command, a Markdown file that tells Claude how to run the entire setup for you. You add one file to your project, run one slash command, and takes you through the setup. What is a Claude Code custom command?
Custom commands / skills are Markdown files you place in a special folder inside your project. When Claude Code starts, it scans this folder and registers each file as a slash command. The filename becomes the command name, so setup-google-sheets.md becomes /setup-google-sheets.
Step 1: find your project root folder
Your project root is the main folder of your codebase, the one you open in your editor or terminal. It usually contains files like .git, package.json, requirements.txt, or similar. For example: C:\Users\you\Projects\my-app or ~/projects/my-app.
Step 2: create the .claude/commands/ folder
Inside your project root, create this folder structure:
The folder is called .claude (with a dot at the beginning). Inside it, create a subfolder called commands.
On Windows (pick one):
PowerShell: open PowerShell in your project folder and run: mkdir -Force .claude\commands
Command Prompt: run: mkdir .claude\commands
File Explorer: open your project folder. Right-click, then New, then Folder. Name it .claude. Open it, create another folder called commands. Windows might warn about the dot, click OK.
Switch Google account changes which Google account is connected
Add/remove tools lets you customize which tools are loaded (to save tokens)
Troubleshoot diagnoses and fixes common connection issues
Choose first-time setup and Claude will walk you through each step interactively, running commands for you and asking for your input when decisions are needed.
If the command doesn't appear
Check the folder path: it must be .claude/commands/ inside your project root (not your home folder)
Make sure the file extension is .md. Windows sometimes hides extensions, so your file might actually be setup-google-sheets.md.txt. Enable "show file extensions" in Explorer settings to check.
Make sure you restarted Claude Code after creating the file
Sharing with your team
Since .claude/commands/ lives inside your project, you can commit it to Git. Anyone who clones your repo gets the /setup-google-sheets command automatically. New team members just run it and follow the prompts, no manual setup guide needed.
Option 2: manual setup
If you prefer to run each step yourself, follow the guide below. This produces the exact same result as the guided setup above.
Install uv (Python package runner)
The MCP server is a Python package that runs via uv, specifically its uvx command, which can run Python packages without permanently installing them. Think of it like npx for Python.
uv is an extremely fast Python package manager made by Astral (the creators of Ruff). It replaces pip, virtualenv, and similar tools.
After installing, restart your terminal and verify:
uvx --version
Set up Google Cloud authentication
The MCP server uses Google's Application Default Credentials (ADC). This means it uses your personal Google login, no service accounts, no API keys, no secrets to manage.
7 additional tools are available (add_columns, create_spreadsheet, create_sheet, copy_sheet, rename_sheet, share_spreadsheet, list_folders). All 19 tools = ~13,000 tokens. Minimal 4 tools = ~3,000 tokens. Use the guided setup's "add/remove tools" option to customize.
Security: what you should know
Let's be transparent about what this setup does:
What's good
Your Google credentials stay local. The MCP server authenticates with Google on your machine. Your Google login tokens are never sent to Anthropic. However, any spreadsheet data that Claude reads will be sent to Anthropic's API as part of your conversation, just like anything else you share with Claude.
No API keys or secrets in config. Authentication uses Google's ADC system with credentials in a secure, system-managed location.
Access. You're using your own Google login, so the MCP server has exactly the same access you do, nothing more.
Full account access. The MCP server can access every spreadsheet your Google account can see. There's no way to restrict it to specific sheets.
Claude can write, not just read. Tools like update_cells, add_rows, and batch_update can modify spreadsheets. Claude asks permission before using tools, but always review what it's about to do.
Third-party package.mcp-google-sheets is maintained by an independent developer, not Google or Anthropic. Though the code is highly vetted by the Github community.
@latest tag. The config uses mcp-google-sheets@latest, so uvx fetches the newest version each time. Pin to a specific version (e.g., mcp-google-sheets==0.3.0) for extra safety.
Use a dedicated Google account if your main account has sensitive data
Consider pinning the package version instead of @latest
Regularly check gcloud auth list to verify the connected account
Troubleshooting
MCP server doesn't appear in Claude Code
Restart Claude Code after editing the config
Check ~/.claude.json. The entry must be inside your project's mcpServers object, not at the top level
Verify the uvx path is absolute and correct
Authentication errors
Re-run gcloud auth application-default login with the full scopes
Set the quota project: gcloud auth application-default set-quota-project YOUR_PROJECT_ID
Verify Sheets and Drive APIs are enabled
"Permission denied" on a specific spreadsheet
The MCP server uses your Google account's permissions. If you can't access a sheet in your browser, Claude can't either
Check gcloud auth list to verify the correct account
Cost
Everything is free except Claude Code: Google Cloud project (free to create), Sheets API (free up to 300 requests/minute), Drive API (free), uv/uvx (open source), mcp-google-sheets (open source). Normal Claude Code usage won't come close to any limits.
Appendix: the full command file
This is the complete content for the guided setup command file. Copy everything in the code block below and paste it into .claude/commands/setup-google-sheets.md in your project (see option 1 above for detailed instructions on where to put this file).
# Google Sheets MCP Setup WizardYou are a setup wizard that helps the user connect Google Sheets to Claude Code via the`xing5/mcp-google-sheets`MCP server.
## Step1:Ask what the user needsUse AskUserQuestion to present these options:
**Question:** "What would you like to do?"
**Options:**
1. **First-time setup** — "Install everything from scratch (uv, GCP auth, MCP config)"2. **Switch Google account** — "Change which Google account the Sheets MCP uses"3. **Add/remove tools** — "Change which Google Sheets tools are loaded (affects token usage)"4. **Troubleshoot** — "The MCP server isn't connecting or isn't working"Then follow the matching path below.
---
## Path 1:First-time setupExecute these steps IN ORDER. Donot skip steps. Runcommands forthe user — don't just tell them to run things.
### 1.1Check prerequisitesRun these checksinparallel:```bash
uv --version 2>/dev/null || echo "NOT_INSTALLED"
uvx --version 2>/dev/null || echo "NOT_INSTALLED"
gcloud --version 2>/dev/null || echo "NOT_INSTALLED"
python --version 2>/dev/null || python3 --version 2>/dev/null || echo "NOT_INSTALLED"
```
**If`uv`/`uvx`is not installed:**
- Detect platform:check ifrunning on Windows(`win32`)or macOS/Linux
- Windows:`powershell -c "irm https://astral.sh/uv/install.ps1 | iex"`
- macOS/Linux:`curl -LsSf https://astral.sh/uv/install.sh | sh`
- Tell the user they may need to restart their terminal or set PATH
**If`gcloud`is not installed:**
- Detect platform:check ifrunning on Windows(`win32`)or macOS/Linux
- Windows:`winget install Google.CloudSDK --accept-package-agreements --accept-source-agreements`
- macOS(withHomebrew):`brew install google-cloud-sdk`
- Linux(Debian/Ubuntu):```bash
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list && \
apt-get update && apt-get install -y google-cloud-cli
```
- Linux(Fedora/RHEL):```bash
curl -fsSL https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg | rpm --import - && \
tee /etc/yum.repos.d/google-cloud-sdk.repo << 'EOF'
[google-cloud-cli]
name=Google Cloud CLI
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64
enabled=1
gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
dnf install -y google-cloud-cli
```
- Tell the user they may need to restart their terminal forgcloud to be available on PATH
- After install,re-check:`gcloud --version 2>/dev/null`
- If still not found,tell the user to install manually from https://cloud.google.com/sdk/docs/install and re-run this setup. STOP here.**If Python is not installed:**
- Detect platform:check ifrunning on Windows(`win32`)or macOS/Linux
- Windows:`winget install Python.Python.3.12 --accept-package-agreements --accept-source-agreements`
- macOS(withHomebrew):`brew install python3`
- macOS(without Homebrew):Tell the user to install from https://python.org
- Linux(Debian/Ubuntu):`sudo apt update && sudo apt install -y python3`
- Linux(Fedora/RHEL):`sudo dnf install -y python3`
- Tell the user they may need to restart their terminal forPython to be available on PATH
- After install,re-check:`python --version 2>/dev/null || python3 --version 2>/dev/null`
- If still not found,tell the user to install manually from https://python.org and re-run this setup. STOP here.
### 1.2GCP project setupCheck existing projects:```bash
gcloud projects list 2>/dev/null
```
**If projects exist:** Ask the user which project to use,or whether to create a newone.
**If no projects:** Create one:```bash
gcloud projects create claude-sheets --name="Claude Sheets"
```
### 1.3Enable APIsRun thiswiththe chosen project ID:```bash
gcloud services enable sheets.googleapis.com drive.googleapis.com --project=PROJECT_ID
```
### 1.4AuthenticateAuthentication requires two gcloud logins:a regular`gcloud auth login`and an ADC(Application DefaultCredentials)login withSheets/Drive scopes. Bothuse the same helper-script pattern below.
#### Authhelper patternSince`gcloud auth --no-launch-browser`is interactive(prints aURL,waits fora code on stdin),use a Python helper script that bridges between gcloud and Claude Code via temp files.
**Step A:** Write the helper script. Replace`GCLOUD_COMMAND`withthe actual gcloud command foreach auth step:```python
#!/usr/bin/env python3
import subprocess, os, sys, time, re
URL_FILE = '/tmp/gcloud_auth_url.txt'
CODE_FILE = '/tmp/gcloud_auth_code.txt'
RESULT_FILE = '/tmp/gcloud_auth_result.txt'
for f in [URL_FILE, CODE_FILE, RESULT_FILE]:
if os.path.exists(f):
os.remove(f)
proc = subprocess.Popen(
GCLOUD_COMMAND, # e.g. ['gcloud', 'auth', 'login', '--no-launch-browser']
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True
)
output = ''
while True:
line = proc.stdout.readline()
if not line and proc.poll() is not None:
break
output += line
# Look for the Google auth URL
if 'accounts.google.com' in line:
url = line.strip()
with open(URL_FILE, 'w') as f:
f.write(url)
# Wait for the user to provide the auth code via CODE_FILE
for _ in range(120):
if os.path.exists(CODE_FILE) and os.path.getsize(CODE_FILE) > 0:
with open(CODE_FILE, 'r') as f:
code = f.read().strip()
proc.stdin.write(code + '\n')
proc.stdin.flush()
break
time.sleep(1)
remaining_output = proc.communicate(timeout=30)[0] or ''
output += remaining_output
with open(RESULT_FILE, 'w') as f:
f.write(output)
```
**Step B:** Run the helperinthe background:```bash
python3 /tmp/gcloud_auth_helper.py &
```
**Step C:** Poll forthe URL file(up to 15 seconds):```bash
for i in $(seq 1 15); do
if [ -f /tmp/gcloud_auth_url.txt ] && [ -s /tmp/gcloud_auth_url.txt ]; then
cat /tmp/gcloud_auth_url.txt
exit 0
fi
sleep 1
done
echo "TIMEOUT"
```
**Step D:** Show the URL to the user via AskUserQuestion. Tellthem to open itintheir browser,signin,and paste the verification code back using the "Other"option.
**Step E:** Write the user's code to the code file:
```bash
echo "THE_CODE_FROM_USER" > /tmp/gcloud_auth_code.txt
```
**Step F:** Poll forthe result file(up to 30seconds)and verify success:```bash
for i in $(seq 1 30); do
if [ -f /tmp/gcloud_auth_result.txt ] && [ -s /tmp/gcloud_auth_result.txt ]; then
cat /tmp/gcloud_auth_result.txt
exit 0
fi
sleep 1
done
echo "TIMEOUT"
```
#### Auth step 1:gcloud loginWrite the helper script withthis command:```python
GCLOUD_COMMAND = ['gcloud', 'auth', 'login', '--no-launch-browser']
```Run the helper pattern(Steps A–F). Verifyoutput contains "You are now logged in as".
#### Auth step 2:Application Default CredentialsClean up the temp files from step 1,then write a newhelper script with:```python
GCLOUD_COMMAND = [
'gcloud', 'auth', 'application-default', 'login',
'--no-launch-browser',
'--scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/drive'
]
```Run the helper pattern(Steps A–F). Verifyoutput contains "Credentials saved".
#### Setquota projectAfter both auth steps succeed:```bash
gcloud auth application-default set-quota-project PROJECT_ID
```
### 1.5Configure MCP serverDetect the platform and find the`uvx`binary path:```bash
# Windows
where uvx 2>/dev/null || echo "C:\\Users\\$USER\\.local\\bin\\uvx.exe"
# macOS/Linux
which uvx 2>/dev/null
```Now add the MCP server to`.claude.json`. Theconfig livesinthe`projects`section under the current project path.
Read`~/.claude.json`and add to the correct project's `mcpServers`:
```json
"google-sheets": {
"command": "FULL_PATH_TO_UVX",
"args": [
"mcp-google-sheets@latest",
"--include-tools",
"get_sheet_data,update_cells,list_spreadsheets,list_sheets,add_rows,find_in_spreadsheet,batch_update_cells,get_sheet_formulas,get_multiple_sheet_data,get_multiple_spreadsheet_summary,batch_update,search_spreadsheets"
]
}
```
IMPORTANT:Use the full absolute path to`uvx` / `uvx.exe`inthe`command`field. Relativepaths or bare`uvx`may not work because MCP servers don't inherit the user's PATH.
UsePython to safely modify the JSON(the file changes frequently,so read-then-edit may fail):```python
import json
with open(CLAUDE_JSON_PATH, 'r') as f:
data = json.load(f)
data['projects'][PROJECT_KEY]['mcpServers']['google-sheets'] = {
'command': UVX_PATH,
'args': [
'mcp-google-sheets@latest',
'--include-tools',
'get_sheet_data,update_cells,list_spreadsheets,list_sheets,add_rows,find_in_spreadsheet,batch_update_cells,get_sheet_formulas,get_multiple_sheet_data,get_multiple_spreadsheet_summary,batch_update,search_spreadsheets'
]
}
with open(CLAUDE_JSON_PATH, 'w') as f:
json.dump(data, f, indent=2)
```
### 1.6Verify & finishTell the user:
- "Setup complete! Restart Claude Code to activate the Google Sheets MCP."
- Show which Google account is connected:`gcloud auth list`
- List the 12tools that were enabled and briefly explain each
---
## Path 2:Switch Google account
### 2.1Show current account```bash
gcloud auth list
```
### 2.2Re-authenticateUse the same auth helper pattern from Path 1step 1.4,but only the ADC step(auth step2). Theuser is already loggedin,they just need newADC credentials withthe Sheets/Drive scopes.
### 2.3Confirm```bash
gcloud auth list
```Tell the user:"Account switched. Restart Claude Code to use the new account."
---
## Path 3:Add/remove tools
### 3.1Show available toolsPresent thislist and ask which tools they want enabled(multi-select):
| Tool | Description |
|------|-------------|
| `get_sheet_data` | Read cell ranges from a sheet |
| `update_cells` | Write values to specific cells |
| `list_spreadsheets` | List all spreadsheets you have access to |
| `list_sheets` | List tabs/sheets within a spreadsheet |
| `add_rows` | Append newrows to the bottom of a sheet |
| `add_columns` | Add newcolumns to a sheet |
| `find_in_spreadsheet` | Search forvalues across a spreadsheet |
| `batch_update_cells` | Bulk write to multiple cell ranges at once |
| `create_spreadsheet` | Create a newspreadsheet |
| `create_sheet` | Add a newtab to an existing spreadsheet |
| `copy_sheet` | Copy a tab to another spreadsheet |
| `rename_sheet` | Rename a tab |
| `share_spreadsheet` | Share a spreadsheet withothers |
| `get_sheet_formulas` | Read formulas(not computedvalues)from cells |
| `get_multiple_sheet_data` | Read from multiple tabsinone call |
| `get_multiple_spreadsheet_summary` | Get overview of multiple spreadsheets |
| `batch_update` | Advanced batch operations |
| `search_spreadsheets` | Search spreadsheets by name |
| `list_folders` | List Drive folders |
**Token guidance:**
- All 19 tools: ~13,000tokens
- Recommended 12(default): ~8,000tokens
- Minimal 4(`get_sheet_data,update_cells,list_spreadsheets,list_sheets`): ~3,000tokens
### 3.2Update configRead`~/.claude.json`,find the`google-sheets`MCP server entry,and update the`--include-tools`argument withthe user's selection. Use the Python JSON approach (same as Path 1 step 1.5).
### 3.3ConfirmTell the user:"Tools updated. Restart Claude Code to apply changes."
---
## Path 4:Troubleshoot
### 4.1Run diagnosticsRun ALL of theseinparallel and collect results:```bash
# Check uv/uvx
uv --version 2>/dev/null || echo "uv: NOT INSTALLED"
uvx --version 2>/dev/null || echo "uvx: NOT INSTALLED"
# Check gcloud auth
gcloud auth list 2>/dev/null
# Check ADC credentials exist
cat ~/.config/gcloud/application_default_credentials.json 2>/dev/null || \
cat ~/AppData/Roaming/gcloud/application_default_credentials.json 2>/dev/null || \
echo "ADC: NOT FOUND"
# Check if Sheets API is enabled
gcloud services list --enabled --filter="name:sheets.googleapis.com" 2>/dev/null
# Check if Drive API is enabled
gcloud services list --enabled --filter="name:drive.googleapis.com" 2>/dev/null
# Try running the MCP server directly to see errors
uvx mcp-google-sheets@latest --help 2>&1 | head -5
```Also read`~/.claude.json`and check that the`google-sheets`entry existsinthe correct project's `mcpServers`.
### 4.2DiagnoseBased on the results,identify the issue and fix it:
| Symptom | Cause | Fix |
|---------|-------|-----|
| `uvx: NOT INSTALLED` | uv not installed | Run the install script from Path 1,step 1.1 |
| `ADC: NOT FOUND` | Never authenticated | Run auth from Path 1,step 1.4 |
| Sheets API notinenabled list | API not enabled | Run enable from Path 1,step 1.3 |
| No`google-sheets`in`.claude.json` | Config missing | Add it via Path 1,step 1.5 |
| MCP showsinlist but errors | Auth expired or scopes wrong | Re-run auth from Path 2 |
| `command`path is wrong | uvx path changed or relative | Find correct path with`where uvx` / `which uvx`and update |
### 4.3Verify fixAfter applying the fix,re-run the relevant diagnostic to confirm. Thentell the user to restart Claude Code.
---
## General rules
- Always RUN commands forthe user,don't just show them
- Use`AskUserQuestion`when a decision is needed
- Use full absolute pathsinall MCP config(not relative,not barecommandnames)
- Use the Python JSON approach to modify`.claude.json`(it changes frequently and file-edit tools may race)
- After any config change,always tell the user to restart Claude Code
- Be concise — don't over-explain unless the user asks "why"