Table of contents

Thousands of companies trust Merge to accelerate AI from PoC to production.
Get a demo

How to connect Google Sheets MCP to Cursor (4 steps)

Jon Gitlin
Senior Content Marketing Manager
at Merge

Developers building Sheets integrations have to leave Cursor, make test API calls, and copy response JSON back in just to understand the data structure.

To help your developers inspect live Sheets API responses more easily within Cursor, we'll show you how to connect Google Sheets with Merge Agent Handler's Google Sheets MCP server.

How it works

Merge Agent Handler connects Cursor to the Google Sheets API through the Merge CLI.

Install the CLI, authenticate once, and run a single setup command from your project root.

That command writes a ## Merge CLI section to the project's .cursorrules file, which tells Cursor's agent when to call merge search-tools and merge execute-tool to reach Google Sheets.

Once connected, Merge will handle OAuth token storage and refresh so you never configure a Google Cloud project or manage credential rotation yourself.

Here's the registration command:

merge setup cursor

Prerequisites

Before getting started, you'll need the following:

  • A Merge Agent Handler account
  • Cursor installed
  • pipx installed (run pipx --version to confirm, or install via pip install pipx)
  • A Google account with access to the spreadsheets you want to connect

If you want to connect Merge Agent Handler's Google Sheets MCP with internal or customer-facing agentic products, you can follow the steps in our docs.

1. Install the Merge CLI

Run the following to install the Merge CLI and confirm it's ready: pipx install merge-api

Verify your installation: merge --version

2. Log in to Merge

Authenticate the CLI with your Merge Agent Handler account: merge login

This links the CLI to your account so it can make authorized requests to Google Sheets on your behalf.

Related: How to use a Google Sheets MCP in Claude Code

3. Connect the CLI to Cursor

Run the following from the root of the project where you want to use Merge tools: merge setup cursor

This writes a ## Merge CLI section to .cursorrules so Cursor knows to use the CLI for third-party services. The command is idempotent, safe to re-run if you need to reset.

4. Authenticate Google Sheets

Open a Cursor chat in your project and start with a query that reflects real development work. For example: "Fetch the first 5 rows from my project tracking spreadsheet and show me the exact JSON response, including how empty cells are represented in the values array, so I can write a row parser that handles sparse data correctly."

The first time you invoke a Google Sheets tool, a Magic Link will appear to complete connector authentication.

Google Sheets auth UI

{{this-blog-only-cta}}

Google Sheets MCP FAQ

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

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

With Google Sheets connected, Cursor can:

  • Fetch a raw values response while writing a row parser: retrieve actual API output from a real sheet to see how the nested array handles empty cells, trailing whitespace, and row length variation before writing normalization logic that depends on it
  • Pull the header row from a target sheet while building a column-mapping function: retrieve the first row of a specific tab to get the actual column labels your code will use to map array indices to named fields in your data model
  • Inspect how the API serializes different value types while implementing a type coercion layer: fetch cells containing dates, currency, and formula outputs to see whether they arrive as typed values or formatted strings before writing the conversion logic
  • Check named range boundaries while coding a range-reading function: retrieve a named range definition to see the exact row and column bounds your reader needs to handle before writing the function that fetches it
  • Verify the A1 notation format for a real sheet while implementing a batch update function: fetch existing cell references from a known sheet to confirm the exact notation format your update requests need to use before writing the payload builder
  • Retrieve sheet tab metadata while writing a multi-tab aggregation tool: fetch the spreadsheet's list of sheets including their tab IDs, titles, and grid dimensions to understand what structure your aggregation logic needs to iterate before coding it

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

You can build a self-hosted MCP server on top of the Google Sheets API. For a solo developer working against their own spreadsheets, the setup is manageable: create a Google Cloud project, configure OAuth credentials, write tool schemas for the ranges and operations you need, and connect it to Cursor.

The scope problem shows up immediately.

Google OAuth credentials at the project level carry access to every spreadsheet the account can reach, not just the ones you intend to expose to the agent. There's no mechanism to restrict a tool to specific sheet IDs or to prevent a write-capable agent from modifying tabs it has no reason to touch. When a developer leaves and their credentials need to be rotated, there's no clean path to revoke their agent's access without rebuilding the credential setup.

At team scale, each developer manages their own OAuth flow with their own tokens and their own version of the tool schemas. There's no shared view of what queries agents are running or what data they're reading across the team's spreadsheets.

Merge Agent Handler adds a control layer on top.

It lets you control exactly which Sheets operations each agent can call: a read-only parser development agent, for example, can only get value and metadata read tools, not batch update or clear operations. Every call is also logged with the timestamp, tool name, and inputs.

For teams where spreadsheets hold operational or financial data, that combination of scoped access and audit logging gives you a deployment you can reason about.

Why connect Google Sheets to Cursor?

Developers building Google Sheets integrations need to understand what the API actually returns before the parsing code can be correct.

The Sheets API documentation describes the values array structure in the abstract. A real response shows you how a specific sheet's data behaves: where the sparse array gaps appear, what the header row actually contains, and how the API serializes the value types your integration needs to handle.

With the Google Sheets MCP connected, Cursor can fetch that reference data inline during the session where the integration is being written.

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

Introducing the new Merge

Company

How Merge activates institutional knowledge with Agent Handler’s Notion connector 

AI

How Merge uses Agent Handler’s Ahrefs connector to automate SEO and AEO research

AI

Subscribe to the Merge Blog

Get stories from Merge straight to your inbox

Subscribe

Connect Cursor to thousands of tools with Merge Agent Handler

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