Google Sheets MCP: Connect your AI to your spreadsheets

by Sujay ChoubeyJul 10, 202613 min read
AI Use CaseMCP

TL;DR

  • Google Sheets MCP connects your AI directly to spreadsheets so it can read, write, and update data without manual copy-paste.

  • Self-hosted MCP servers require terminal-level setup and may encounter authentication challenges during extended sessions.

  • Composio's managed MCP server handles token refresh automatically, runs in the cloud, and holds SOC 2 and ISO 27001 certification.

  • The free tier includes 20,000 tool calls per month with no credit card required.

  • Claude Code, ChatGPT, and Codex: this guide covers all three.

It is not unusual for consultants or small teams to run their entire operation from Google Sheets: client pipelines, project trackers, lead lists, and budget models. But unfortunately, your AI assistant can't see any of it. It can't update your project tracker or append a row when a new lead comes in, unless you build a bridge between them.

That bridge is the Model Context Protocol (MCP). Think of it as a universal connector for AI: the AI model acts as the brain, deciding what it wants to do, and the MCP server acts as the nervous system, translating that intent into actual spreadsheet actions.

This guide walks you through the fastest path to get that connection working.

What is MCP and why use it with Google Sheets?

MCP is a public protocol that creates a two-way channel between an AI (like Claude Code or Cursor) and connected apps (like Google Sheets). When your AI client starts up, it opens a channel to the MCP server, which responds with a list of available tools, things like "read spreadsheet data," "append a row," or "create a new sheet." The AI can then call those tools mid-conversation, in real-time, based on what you ask it to do.

Traditional approaches force you to either export data manually (copy a CSV, paste it into the chat) or build a custom API integration from scratch, but MCP cuts through both options. The Google Sheets MCP integration via Composio supports both MCP-based and direct API access with structured, LLM-friendly schemas, meaning the AI gets clean, predictable responses rather than raw JSON walls that can confuse its reasoning.

If you need to decide whether to run a self-hosted MCP server on your machine or use a managed one, here's how the two paths compare:

Feature

Self-hosted MCP

Managed MCP (Composio)

Setup time

Varies: 30 minutes to several hours depending on environment

Quick one-click auth, no terminal setup

OAuth token refresh

Must update yourself

Automatic (managed auth layer)

Hosting requirement

Your own computer or a purchased server

Cloud-hosted by Composio

Security certification

None included; depends on your implementation

SOC 2 and ISO 27001

Technical skill level

High (terminal, JSON editing)

Low to medium (one-click auth)

How to connect Google Sheets to ChatGPT

Integrating Google Sheets with ChatGPT allows your AI agent to read, update, and manage spreadsheet data through natural language. Instead of manually working with the Google Sheets API, Composio provides a toolkit that handles authentication, permissions, and tool execution, making it much faster to build production-ready AI workflows.

The following steps outline how to connect Google Sheets to ChatGPT using Composio.

Prerequisites

Before you begin, make sure you have a free Composio account, access to the OpenAI API, and a Google account with permission to use Google Sheets.

Step 1: Enable developer mode

Before connecting Google Sheets to ChatGPT, you'll need to:

Open Settings and go to Apps → Go to Advanced settings → Turn on Developer Mode.

This setting enables support for MCP (Model Context Protocol) servers, allowing ChatGPT to securely connect with external services like Composio.

Developer Mode allows ChatGPT to communicate with MCP servers that expose external tools and integrations. Without it enabled, ChatGPT won't be able to discover or use Composio's Google Sheets toolkit. This is a one-time setup, so once it's enabled, you can connect additional MCP-powered integrations as well.

Step 2: Add the Composio MCP server

After enabling Developer Mode:

Click Create app inside ChatGPT → Add the Composio MCP server by entering the MCP endpoint provided by Composio.

This registers Composio as an available tool provider, allowing ChatGPT to access the Google Sheets integration.

Step 3: Authorize your Composio account

Once the MCP server has been added, ChatGPT automatically opens a browser window for authentication. Sign in to your Composio account and complete the OAuth authorization process to grant access to your connected Google Sheets account.

During authorization, Composio securely requests the permissions needed to access your Google Sheets data. If you're connecting a personal or work Google account, review the requested scopes before approving access. After authorization is complete, the connection is ready to use within ChatGPT.

Step 4: Start using Google Sheets

After the authorization process is complete and Composio is enabled, ChatGPT can perform Google Sheets actions using plain English prompts. For example, you can ask it to create a new worksheet, update rows that match specific criteria, generate charts from spreadsheet data, or clear values from a selected worksheet, all without writing code or interacting directly with the Google Sheets API.

How to connect Google Sheets to Claude Code

Prerequisites

Before connecting Google Sheets to Claude Code, ensure you have:

  • Claude Code installed

  • A free Composio account

  • A Google account with access to Google Sheets

Step 1: Add the Composio MCP to Claude

The first step is to add the Composio MCP (Model Context Protocol) server to Claude Code. Click the Generate MCP URL button on the Composio page to create a unique MCP endpoint for your account.

This endpoint acts as the bridge between Claude Code and Google Sheets, allowing Claude to securely access spreadsheet tools without requiring you to manually configure OAuth or API integrations.

Step 2: Start Claude Code

After generating the MCP URL, launch Claude Code by running the claude command from your terminal.

This opens the Claude Code interface, where you'll be able to configure and manage MCP servers. Starting Claude Code ensures you're working within an environment that supports MCP-powered integrations like Google Sheets.

Step 3: Open your MCP list

With Claude Code running, enter the /mcp command to open the list of configured MCP servers.

This menu displays all available integrations connected to Claude Code and allows you to manage authentication, permissions, and server status from a single location.

Step 4: Select Composio and authenticate

After that, locate Composio in the MCP list and select the Authenticate option.

Claude Code will recognize that the integration hasn't been authorized yet and will begin the authentication process. This step establishes a secure connection between your Claude Code session and your Composio account before any Google Sheets operations can be performed.

Step 5: Complete the Composio OAuth flow

Selecting Authenticate redirects you to the Composio OAuth page in your browser. Sign in to your account → Grant the requested permissions → Complete the authorization process.

Once authentication is finished, Claude Code can access your Google Sheets through Composio, allowing you to create spreadsheets, update rows, generate charts, and perform other spreadsheet operations using natural language prompts.

How to connect Google Sheets to Codex

Prerequisites

Before connecting Google Sheets to Codex, make sure you have:

  • Codex installed

  • A free Composio account with access to the Google Sheets toolkit

  • A Google account that you can authorize during the setup process.

Step 1: Configure the Codex app

If you're using the Codex desktop application instead of the CLI, you can configure the integration through the MCP Servers settings:

  • Add a new Streamable HTTP server, enter the Composio MCP endpoint

  • Provide your Composio API key in the required header field

  • Verify that the MCP server has been added to your configuration file.

Once complete, you'll be able to interact with Google Sheets directly from the Codex app using natural language prompts.

Step 2: Run the setup command in your terminal

Start by running the setup command provided on the Composio page. Click Generate MCP URL to create a unique MCP endpoint for your account.

Running the generated command adds the Composio MCP server to Codex and initiates the authentication flow in your browser, allowing Codex to securely connect to your Composio account.

Step 3: (Optional) authenticate with OAuth

If you prefer to authenticate manually or need to reconnect your account later, you can use the codex mcp login composio command.

This opens your browser and starts the OAuth authorization flow, where you'll sign in to Composio and grant the necessary permissions for Google Sheets access. After completing the authorization, the connection is ready to use within Codex.

Step 4: Verify the connection

Once the MCP server has been added and authentication is complete. Verify the installation by running codex mcp list.

This command displays all registered MCP servers and confirms that Composio has been successfully configured. If the server appears in the list, Codex is ready to access Google Sheets through the Composio integration.

Real-world use cases for Google Sheets MCP

Once your connection is live, these three patterns deliver immediate time savings for solo operators and consultants:

Get AI answers from Google Sheets

A consultant managing multiple client engagements typically stores status data, budgets, and milestone dates across several sheets. With the MCP connection live, you can ask Claude to pull the current status of all active projects, identify which are behind schedule, and draft a progress summary for your weekly check-in, without opening a single spreadsheet manually.

Claude reads directly from your live data, so the summary reflects your actual numbers rather than whatever you last exported. For teams that want to build this kind of reporting into a recurring workflow, the Claude Agent SDK integration supports persistent agent sessions; pair it with Composio triggers to run these queries on a schedule.

Batch update cells via Google Sheets MCP

A marketer running outbound campaigns often maintains a lead list in Google Sheets. After a call or email sequence, updating the status column across many rows manually is repetitive and error-prone. With the MCP connection, you paste the list of outcomes into the chat and ask the AI to update the corresponding rows directly.

The AI uses the write and append methods from the Google Sheets toolkit to hit each row with the correct value. Teams running this at higher volume can pair it with AutoGen or Mastra AI for fully automated batch operations across multiple sheets.

Trigger actions with Google Sheets MCP

One of the more useful patterns for solo operators: you add a new row to a sheet (a new lead, a completed order, an incoming request), and the AI detects it and takes a downstream action. Using Composio's Tool Router, a single MCP URL routes the agent's next action to Gmail, Slack, or HubSpot based on which services you have connected.

When a row appears in your leads sheet, the agent can draft a personalized outreach email in Gmail using the data from that row, no separate workflow tool, no manual trigger.

Troubleshooting your Google Sheets MCP setup

Resolving Google Sheets login failures

If the Google authorization window doesn't open or shows an error after you click the Composio connection link, the most common cause is a browser cookie restriction blocking the OAuth pop-up. Work through these steps in order:

  1. Check your browser: Open your default browser and confirm you're logged into the correct Google account.

  2. Regenerate the link: Go to your Composio dashboard and regenerate the connection link.

  3. Try incognito: Click the new link. If the pop-up is still blocked, copy the link and open it directly in an incognito window with third-party cookies enabled.

Restoring lost Google Sheets sync

Google OAuth access tokens expire after 60 minutes under standard conditions. After that window closes, the Google API returns a 401 error indicating the token needs manual re-authorization. This is what kills self-hosted setups mid-task.

Composio's managed auth layer handles this automatically in the background, so you shouldn't see a 401 error under normal operation. If you do see one, it typically means you manually revoked the connection or cleared your browser session. Fix it by opening your Composio dashboard, finding the Google Sheets connection, and clicking Re-authorize. One Google login and the managed layer takes over again. No changes to the config file are needed.

Fixing restricted Google Sheets access

"Permission Denied" errors almost always mean the Google account you connected to doesn't have edit access to the specific spreadsheet the AI is trying to modify. The Composio connection links to your Google account, not to individual files.

Check that the target sheet is shared with (or owned by) the account you used during the OAuth step. If you need the agent to access a sheet owned by a colleague, that person needs to share it with edit permissions to your connected account first. You can also review which MCP server permissions are active for your connection and scope them down to read-only if you're working in a shared environment where write access would be a problem.

For teams managing multiple connections or users, the Composio MCP server API supports creating custom server instances with specific permission sets, and the custom multi-app MCP endpoint lets you bundle Google Sheets with other tools under one controlled configuration.

Start with Composio's free tier, 20,000 tool calls per month, no credit card required, and connect Google Sheets to Claude Code in under one sitting. The setup you complete today will still be running next quarter.

FAQs

How long do Google OAuth tokens last before they need refreshing?

Google OAuth access tokens expire after 60 minutes by default. Composio's managed auth layer rotates and refreshes tokens in the background continuously, so your AI sessions stay active without any interruption or re-authorization prompt.

What do you need to set up Google Sheets MCP?

You need a free Composio account (no credit card, 20,000 tool calls per month included), a Google account with access to the sheets you want the AI to use, and an MCP-compatible client like Claude Code or Cursor.

Is Composio secure?

Composio is SOC 2 and ISO 27001 compliant with all data encrypted in transit and at rest.

Can I manage the permissions and scopes for Google Sheets while using Tool Router?

Yes. You can configure which Google Sheets scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

Glossary

Model Context Protocol (MCP): A public protocol that creates a two-way channel between an AI client and connected apps. The AI model sends tool requests; the MCP server translates them into actions against an external service like Google Sheets.

MCP server: The component that receives tool requests from an AI client, executes them against a connected app (e.g., Google Sheets), and returns structured responses. Can be self-hosted on a local machine or managed in the cloud by a provider like Composio.

OAuth / OAuth 2.0: The authorization protocol Google uses to grant third-party apps (like Composio) access to your Google account data. OAuth access tokens expire after 60 minutes and must be refreshed to maintain an active session.

OAuth token refresh: The process of exchanging an expired OAuth access token for a new one without requiring the user to re-authorize. Self-hosted MCP setups require this to be handled manually; Composio's managed auth layer handles it automatically in the background.

LLM-friendly schema: A structured data format designed for predictable consumption by large language models. Instead of returning raw JSON walls, Composio formats tool responses with clean field names and consistent structures so the AI's reasoning isn't confused by unexpected output shapes.

Share