-
The Problem. Working with spreadsheet data in AI tools means constant copy-pasting between windows, losing context and making mistakes.
-
The Solution. Connect Claude Code directly to Google Sheets using MCP (Model Context Protocol) and a service account, giving Claude read/write access to a designated folder.
-
The Setup. About 20 minutes: create a Google Cloud project, enable APIs, set up a service account, share a Drive folder, and configure Claude Code with one terminal command.
Why connect Claude Code to Google Sheets
Most business teams live in spreadsheets. Sales pipelines, financial reports, inventory tracking, customer lists, project timelines. The data is there, but extracting insights or cleaning it up often requires either manual work or technical skills that not everyone has.
Claude Code changes this equation. By connecting it directly to your Google Sheets, you can ask questions about your data, clean up messy entries, generate summaries, and automate repetitive tasks, all from a simple conversation in your terminal.
Instead of copying data into a chat window, pasting results back, and hoping nothing breaks, you get a direct connection. Claude reads your spreadsheet, understands the structure, and can make changes when you ask.
This guide walks through the setup using MCP (Model Context Protocol), Anthropic's standard for connecting AI assistants to external tools. The setup takes about 15-20 minutes, and once done, you can work with any Google Sheet in your designated folder.
What you will need
Before starting, make sure you have these ready:
- Claude Code installed on your computer
- A Google account (personal Gmail or Google Workspace)
- About 20 minutes for the initial setup
No coding experience required. The setup involves clicking through Google Cloud Console and running a few terminal commands.
A terminal (also called "command prompt" on Windows or "command line") is a text-based way to control your computer. Instead of clicking icons, you type commands. On macOS, open the Terminal app from Applications > Utilities. On Windows, search for "PowerShell" in the Start menu. You will copy and paste the commands from this guide.
Step 1: Create a Google Cloud project
Google Cloud provides the APIs that let Claude Code talk to your spreadsheets. You need a project to organize these APIs and credentials.
Open Google Cloud Console
Go to console.cloud.google.com. Sign in with the Google account that has access to the spreadsheets you want to use.
Create a new project
- Click the project dropdown at the top of the page (it might say "Select a project" or show an existing project name)
- Click "New Project" in the popup
- Enter a name like "Claude-Sheets-Access"
- Leave the organization as default
- Click "Create"
Wait a few seconds for the project to be created, then make sure it is selected in the dropdown.
Step 2: Enable the required APIs
Claude Code needs two APIs enabled to work with your spreadsheets: the Google Sheets API for reading and writing cell data, and the Google Drive API for finding and listing your files.
An API (Application Programming Interface) is a way for software to talk to other software. When you enable the Google Sheets API, you are giving permission for external tools (like Claude Code) to read and write your spreadsheet data through Google's servers. Without the API enabled, Google blocks all outside access.
Navigate to the API Library
- In the left sidebar, click "APIs & Services"
- Click "Library"
Enable Google Sheets API
- Search for "Google Sheets API"
- Click on it in the results
- Click the blue "Enable" button
- Wait for it to activate
Enable Google Drive API
- Go back to the Library (click "APIs & Services" then "Library" again)
- Search for "Google Drive API"
- Click on it and click "Enable"
Both APIs should now show as enabled in your project.
Step 3: Create a service account
A service account is like a robot user that Claude Code uses to access your sheets. It has its own email address and credentials, keeping your personal Google account separate from the automation.
Create the service account
- In the left sidebar, click "APIs & Services"
- Click "Credentials"
- Click "+ Create Credentials" at the top
- Select "Service account"
Configure the service account
- Enter a name like "claude-sheets-bot"
- The service account ID will auto-fill based on the name
- Add a description like "Service account for Claude Code spreadsheet access"
- Click "Create and Continue"
Set permissions
- In the "Grant this service account access" step, click the "Select a role" dropdown
- Search for "Editor" and select "Editor" under Basic roles
- Click "Continue"
- Skip the "Grant users access" step by clicking "Done"
Download the credentials file
- You should now see your service account in the credentials list
- Click on the service account email to open its details
- Go to the "Keys" tab
- Click "Add Key" then "Create new key"
- Select "JSON" format
- Click "Create"
A JSON file will download to your computer (usually to your Downloads folder). This file contains the credentials Claude Code needs.
JSON (JavaScript Object Notation) is a simple text format for storing data. Your credentials file is just a text file containing your service account's email, a private key, and other details in a structured format. You can open it with any text editor to see what is inside, but do not modify it.
Store the credentials safely
Move the downloaded JSON file to a permanent location. You will need the full path to this file later in Step 6.
Simplest option: Create a folder on your Desktop called claude-credentials and move the JSON file there. Rename the file to credentials.json for simplicity.
Your path would then be:
- macOS: /Users/yourname/Desktop/claude-credentials/credentials.json
- Windows: C:\Users\YourName\Desktop\claude-credentials\credentials.json
(Replace "yourname" with your actual username)
Important: Write down or copy the full path to your credentials file. You will need it in Step 6.
This file is sensitive. Treat it like a password. Anyone with access to it can access your shared spreadsheets. Do not share it or upload it anywhere.
Step 4: Set up your Google Drive folder
The service account needs access to a specific folder in your Google Drive. You will share this folder with the service account, and any spreadsheets inside it become accessible to Claude Code.
Create a dedicated folder
- Go to drive.google.com
- Click "New" then "New folder"
- Name it something like "Claude-Accessible-Sheets"
- Click "Create"
Find the service account email
Open the JSON credentials file you downloaded. Look for the client_email field. It will look something like:
claude-sheets-bot@claude-sheets-access.iam.gserviceaccount.com
Copy this email address.
Share the folder with the service account
- Right-click on your new folder in Google Drive
- Click "Share"
- Paste the service account email address
- Set the permission to "Editor" (so Claude can also write to sheets)
- Uncheck "Notify people" (the service account cannot receive emails)
- Click "Share"
Get the folder ID
- Open the folder by double-clicking it
- Look at the URL in your browser
- Copy the long string after /folders/
For example, if the URL is:
https://drive.google.com/drive/folders/1AbCdEfGhIjKlMnOpQrStUvWxYz
The folder ID is 1AbCdEfGhIjKlMnOpQrStUvWxYz.
Save this ID. You will need it in the next step.
Step 5: Install the MCP server
Now we shift from Google Cloud setup to your local computer. This step installs the software that connects Claude Code to Google Sheets.
Before you continue, make sure you have:
- Claude Code installed and working on your computer
- A terminal or command prompt open
- The credentials JSON file saved (from Step 3)
- The folder ID copied (from Step 4)
If you do not have Claude Code yet, install it first by following the instructions at claude.ai/code.
What is the MCP server?
Think of MCP like a translator at an international business meeting. Claude Code speaks one language, Google Sheets speaks another. The MCP server sits in the middle, translating requests back and forth so they can work together.
MCP (Model Context Protocol) is Anthropic's standard for connecting AI tools to external services. The MCP server runs quietly in the background on your computer. When you ask Claude to read a spreadsheet, it sends that request to the MCP server, which then fetches the data from Google and returns it.
We will use mcp-google-sheets, an open source MCP server built specifically for Google Sheets integration.
Install uv (the package runner)
The MCP server is distributed as a Python package. We use a tool called uv to download and run it automatically. You do not need to know Python to use it.
uv is a fast package manager created by Astral. Think of it like an app store for Python tools. When you run uvx mcp-google-sheets, uv automatically downloads the MCP server, installs any dependencies it needs, and runs it. This avoids the headache of manually installing Python packages. The "uvx" command is specifically for running packages without permanently installing them.
Open your terminal and run:
On macOS or Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
On Windows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
After installation, close and reopen your terminal for the changes to take effect.
Verify uv is installed
Run this command:
uv --version
You should see a version number like "uv 0.4.x" or similar.
Test the MCP server
Now test that the MCP server can be downloaded and run:
uvx mcp-google-sheets@latest --help
This command downloads the latest version of the MCP server and shows its help text. If you see options and usage information, the installation worked.
Step 6: Configure Claude Code
Now you need to tell Claude Code about the MCP server and your credentials.
Add the MCP server to Claude Code
Run this command in your terminal, replacing the placeholder values with your actual paths:
On macOS or Linux:
claude mcp add google-sheets \
--command "uvx" \
--args "mcp-google-sheets@latest" \
--env SERVICE_ACCOUNT_PATH="YOUR_PATH" \
--env DRIVE_FOLDER_ID="YOUR_FOLDER_ID"
Example with real paths:
--env SERVICE_ACCOUNT_PATH=\
"/Users/jo/Desktop/claude-creds/creds.json"
--env DRIVE_FOLDER_ID="1AbCdEfGhIjKl..."
On Windows (PowerShell):
claude mcp add google-sheets `
--command "uvx" `
--args "mcp-google-sheets@latest" `
--env SERVICE_ACCOUNT_PATH="YOUR_PATH" `
--env DRIVE_FOLDER_ID="YOUR_FOLDER_ID"
Replace:
- SERVICE_ACCOUNT_PATH with the actual path to your credentials file (from Step 3)
- DRIVE_FOLDER_ID with the folder ID you copied (from Step 4)
Verify the configuration
Check that the MCP server was added:
claude mcp list
You should see google-sheets in the list.
Step 7: Test the connection
Time to verify everything works.
Start Claude Code
claude
Ask Claude to list your spreadsheets
Try this prompt:
List all the spreadsheets in my Google Drive folder
If everything is configured correctly, Claude will show you any spreadsheets in your shared folder. If the folder is empty, create a test spreadsheet in Google Sheets and move it to your "Claude-Accessible-Sheets" folder.
Test reading data
Create a simple spreadsheet with some sample data, then ask:
Read the data from my "Test Spreadsheet" and summarize what's in it
Claude should retrieve the data and describe its contents.
Practical examples
Once connected, here are some ways to use Claude Code with your spreadsheets.
Analyzing sales data
Ask Claude to find patterns and insights you might miss when manually scanning rows.
Read my "Q4 Sales Report" spreadsheet and tell me:
1. Which product had the highest revenue
2. Which region is underperforming
3. Any trends you notice month over month
Cleaning up messy data
Data hygiene tasks that would take hours can happen in seconds.
Look at my "Customer List" spreadsheet. Find and fix:
- Duplicate entries
- Inconsistent formatting in the phone number column
- Empty required fields
Generating summaries
Turn raw data into stakeholder-ready narratives.
Read my "Project Timeline" spreadsheet and create
an executive summary I can send to stakeholders.
Include key milestones and any items that are behind schedule.
Creating formulas
Let Claude write the formulas so you can focus on the analysis.
In my "Budget Tracker" spreadsheet, add a column
that calculates the variance between planned and
actual spending, then highlight any row where
we're more than 10% over budget.
Transforming data
Restructure data between formats without manual copy-paste.
Take the data from my "Survey Responses" spreadsheet
and reorganize it so each question is a column header
and each response is a row. Right now it's in a
different format.
Troubleshooting
Here are solutions to common issues.
| Problem | Likely Cause | Solution |
|---|---|---|
| Cannot find spreadsheets | Sheet not in shared folder | Move the spreadsheet into your Claude-Accessible-Sheets folder |
| Permission denied errors | Folder not shared correctly | Re-share the folder with the service account email as Editor |
| MCP server not found | uv not in PATH | Restart your terminal or run source ~/.bashrc |
| Invalid credentials | Wrong file path | Check the SERVICE_ACCOUNT_PATH in your MCP config |
| API not enabled | Skipped Step 2 | Go back to Google Cloud Console and enable both APIs |
Checking MCP server logs
If something is not working, you can see what the MCP server is doing:
claude mcp logs google-sheets
This shows recent activity and any error messages.
Resetting the configuration
If you need to start over with the MCP configuration:
claude mcp remove google-sheets
Then re-run the claude mcp add command with the correct values.
Tips for daily use
Organize your sheets
Keep spreadsheets you want Claude to access in your dedicated folder. This keeps things organized and limits what Claude can see.
Be specific about sheet names
When you have multiple spreadsheets, use exact names:
Read the "2024 Q4 Sales - Final" spreadsheet, not the draft version
Ask for confirmation before changes
When you want Claude to modify data, ask it to describe what it will do first:
Look at my expense report and tell me what changes
you would make to fix the formatting.
Don't make changes yet, just describe them.
Use ranges for large sheets
For spreadsheets with thousands of rows, specify what you need:
Read only the first 100 rows of my customer database,
focusing on the Name and Email columns
Combine with other tools
Claude Code can do more than just spreadsheet work. You can ask it to read a sheet, analyze the data, and then write a summary to a file or even create a chart description.
What the MCP server can do
The mcp-google-sheets server provides these capabilities:
| Capability | What It Does |
|---|---|
| list_spreadsheets | Show all spreadsheets in your folder |
| create_spreadsheet | Make a new spreadsheet |
| get_sheet_data | Read data from cells |
| update_cells | Write data to cells |
| batch_update_cells | Update multiple ranges at once |
| get_sheet_formulas | See the formulas in cells |
| list_sheets | Show all tabs in a spreadsheet |
| create_sheet | Add a new tab |
| add_rows / add_columns | Insert new rows or columns |
| share_spreadsheet | Share with other users |
Security considerations
A few things to keep in mind:
The service account has broad access. Any spreadsheet in the shared folder can be read and modified. Do not put sensitive financial or personal data in that folder unless you are comfortable with that access level.
Credentials should stay private. The JSON credentials file should not be shared, committed to version control, or stored in cloud sync folders. Treat it like a password.
You can revoke access anytime. If you need to cut off access, either remove the service account from the shared folder in Google Drive, or delete the service account entirely in Google Cloud Console.
Next steps
Now that Claude Code is connected to your spreadsheets, experiment with your actual work data. Start with read-only tasks like analysis and summaries before asking Claude to make changes.
The combination of conversational AI and direct spreadsheet access removes a significant friction point for business teams. Instead of context-switching between tools or manually copying data, you can stay in one interface and let Claude do the heavy lifting.
For teams that want to go further, consider setting up additional MCP servers for Google Docs, Slack, or databases. The same pattern applies: enable APIs, create credentials, configure Claude Code, and start working.