Table of contents

Add secure integrations to your products and AI agents with ease via Merge.
Get a demo

How to connect Google Sheets MCP with Claude Code (5 steps)

Jon Gitlin
Senior Content Marketing Manager
at Merge

Developers end up storing more operational data in Google Sheets than they plan to. Experiment results, API usage logs, feature flag states, cost-per-environment breakdowns, manual QA logs: the list grows because Sheets is fast to set up and easy to share.

But that data is invisible to Claude Code by default.

When your developers are debugging a regression, checking whether an experiment variant hit a threshold, or validating a model output against a reference table, they either open a browser tab or paste the data in manually.

To help your developers read and update spreadsheet data without leaving the terminal, we'll show you how to connect Google Sheets with Merge Agent Handler's Google Sheets MCP server.

How it works

Merge Agent Handler acts as a secure bridge between Claude Code and the Google Sheets API. When you configure a Tool Pack and Registered User, Merge generates a unique MCP URL that Claude Code accesses via HTTP. Authentication uses an API key generated in Merge Agent Handler. Claude Code never touches your Google OAuth credentials directly.

Here's the connection config before you substitute your specific values:

claude mcp add 
--transport http --header "Authorization: Bearer YOUR_API_KEY"
agent-handler
"https://ah-api.merge.dev/api/v1/tool-packs/YOUR_TOOL_PACK_ID/registered-users/YOUR_REGISTERED_USER_ID/mcp"

Claude Code sends requests to that MCP URL, and Merge handles OAuth token management and API calls to Google Sheets on the backend. You don't manage Google credentials locally or wire up token refresh. Merge handles both.

Prerequisites

Before getting started, you'll need the following:

  • A Merge Agent Handler account
  • Claude Code installed (run <code class="blog_inline-code">claude --version</code> to confirm)
  • A Google account with access to the Sheets you want to connect

Related: A guide to integrating a Stripe MCP with Claude Code

1. Create a Tool Pack

Log into Merge Agent Handler and navigate to Tool Packs. Click Create Tool Pack and give it a name tied to your use case, like sheets analysis agent.

Tool Pack creation UI

Under connectors, select Google Sheets, and choose which tools to enable.

For most read-heavy workflows—pulling experiment data, checking a metrics tab, or reading a reference table—enabling row retrieval, sheet search, and cell range reads covers the core cases. Add write tools like append_rows or update_cells if your agent needs to write results back to the sheet.

Save the Tool Pack. You'll return here in step 4 to copy your MCP URL.

2. Add a Registered User

Inside your Tool Pack, create a Registered User. This is the identity context under which your agent operates.

Adding a Registered user

Give it a name that maps to your environment, like dev-local or your own name. Once created, Merge generates a unique MCP URL scoped to this user.

3. Authenticate Google Sheets

From the Registered User detail page, click Add Connector and select Google Sheets. This starts a standard Google OAuth flow.

Google Sheets auth UI

Sign in with the Google account that has access to the spreadsheets you want Claude Code to reach, and grant the requested permissions.

Once the OAuth flow completes, Merge stores and manages the access token. You won't need to re-authenticate unless you revoke access.

4. Gather your credentials

You need two things before configuring Claude Code:

1. MCP URL: found on the Tool Pack detail page under the Registered User you just created. It looks like this:

‍https://ah-api.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp

2. API key: found in Settings > API Keys in your Merge Agent Handler dashboard. Create one if you don't have one yet.

Keep both handy for the next step.

5. Configure Claude Code with Google Sheets

Run the following command in your terminal, substituting your actual MCP URL and API key:

claude mcp add 
--transport http --header "Authorization: Bearer YOUR_API_KEY"
agent-handler
"https://ah-api.merge.dev/api/v1/tool-packs/YOUR_TOOL_PACK_ID/registered-users/YOUR_REGISTERED_USER_ID/mcp"

Verify the connection registered with the command <code class="blog_inline-code">claude mcp list</code>.

<code class="blog_inline-code">agent-handler</code> should appear in the output with a connected status.

To confirm the connector is accessible, open a Claude Code session and run something like "Pull the data from the 'Results' tab in the Q2 Experiment Tracker sheet and tell me which variant had the highest conversion rate."

Your output can look something as follows:

Example of using Google Sheets MCP in Claude Code

{{this-blog-only-cta}}

Google Sheets MCP FAQ

In case you have more questions on setting up and using the Google Sheets MCP in Claude Code, we've addressed several more commonly-asked questions below.

What can you do once the Google Sheets MCP is connected to Claude Code?

With Google Sheets connected, Claude Code can:

  • Read rows and cell ranges: retrieve data from any tab in a spreadsheet without opening a browser or copy-pasting values into context
  • Search across sheets: find the right spreadsheet by name or content when you're not sure of the exact file
  • List sheets and tabs: browse available spreadsheets and their tabs to understand structure before querying specific data
  • Append and update rows: write results, log entries, or generated output directly back to a spreadsheet (if write tools are enabled in your Tool Pack)
  • Cross-reference live data while coding: ground Claude's analysis in current spreadsheet values rather than stale exports or hardcoded fixtures
  • Query structured data in plain language: ask questions like "which rows in the metrics sheet have a p-value below 0.05?" and get answers without writing a formula or script

Why use Merge Agent Handler vs. a self-hosted Google Sheets MCP server?

You can run a self-hosted MCP server that calls the Google Sheets API directly. For a solo developer working against one spreadsheet, that works: store your OAuth credentials, write tool schemas for the ranges you need, and connect it to Claude Code.

The problem surfaces when more than one person needs access, or when your spreadsheets contain sensitive data. Google OAuth credentials stored locally carry access to everything the account can reach, not just the sheets you intend. There are no tool-level controls to restrict an agent to read-only access or to block it from specific tabs. And there's no audit trail showing what data the agent retrieved.

Merge Agent Handler adds a control layer on top. You define exactly which tools each Tool Pack exposes, so a read-only analysis agent never gets update_cells. Each developer gets their own Registered User with isolated credentials, so revoking one person's access doesn't affect anyone else's setup. And every tool call is logged with the tool name, inputs, and response metadata.

In short, for teams where spreadsheets hold operational or financial data and multiple people run agents against them, the access controls and audit trails are worth the setup.

Why connect Google Sheets to Claude Code?

Sheets is how a lot of teams track the state of their systems. Not because it's the ideal database, but because it's fast to set up, easy to share, and flexible enough to hold anything: experiment results, bug counts by priority, API cost breakdowns, deployment checklists, or quarterly planning data. That data influences engineering decisions constantly, but it's disconnected from the terminal.

Connecting Google Sheets via MCP closes that gap.

Developers can ask Claude Code to pull a specific range, evaluate whether a metric crossed a threshold, append a new row with generated output, and more without a context switch. For teams running A/B tests, building internal tooling, or maintaining operational spreadsheets alongside their codebase, that means fewer browser tabs and fewer manual data-to-context handoffs mid-session.

Jon Gitlin
Senior Content Marketing Manager
@Merge

Jon Gitlin is the Managing Editor of Merge's blog. He has several years of experience in the integration and automation space; before Merge, he worked at Workato, an integration platform as a service (iPaaS) solution, where he also managed the company's blog. In his free time he loves to watch soccer matches, go on long runs in parks, and explore local restaurants.

Read more

Zero data retention gateway: overview, benefits, and implementation steps

AI

How to connect the Cloudflare MCP with Claude Code (5 steps)

AI

How to connect to the Jira MCP with Claude Code (5 steps)

AI

Subscribe to the Merge Blog

Get stories from Merge straight to your inbox

Subscribe

Connect your agents to thousands of tools in minutes

Use Merge Agent Handler’s 150+ connectors (including Google Sheets) to power reliable, secure, and powerful agents.

Get started for free
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text