How to integrate Google Sheets MCP with Codex

Connect Codex to Google Sheets MCP. Add a new sheet named 'q3 sales', update all rows where status is 'pending', and more using natural language, with authentication handled for you.

Google Sheets logoGoogle Sheets
Oauth2

Google Sheets is a cloud-based spreadsheet tool for real-time collaboration and data analysis. It lets teams work together from anywhere, updating information instantly.

50 Tools16 Triggers

Introduction

Codex is one of the most popular coding harnesses out there. And MCP makes the experience even better. With the Google Sheets MCP integration, Codex can work with your Google Sheets account, all without leaving the terminal or the app, whichever you prefer.

Also integrate Google Sheets with

Why use Composio?

Apart from a managed and hosted MCP server, you will get:

  • CodeAct: A dedicated workbench that allows GPT to write its code to handle complex tool chaining. Reduces to-and-fro with LLMs for frequent tool calling.
  • Large tool responses: Handle them to minimise context rot.
  • Dynamic just-in-time access to 20,000 tools across 1500+ other Apps for cross-app workflows. It loads the tools you need, so GPTs aren't overwhelmed by tools you don't need.

How to install Google Sheets MCP in Codex

Run the setup command

Run this command in your terminal to add the Composio MCP server to Codex.

Terminal

It will initiate the authentication in a browser window, authorize Codex to access your Composio account.

Composio authentication page

(Optional) Authenticate with OAuth

To authenticate manually, run the login command to open a browser window and authorize Codex to access your Composio account.

bash
codex mcp login composio

Verify the connection

Run codex mcp list to confirm Composio appears as a registered MCP server.

bash
codex mcp list

Codex App

Codex App follows the same approach as VS Code.

  1. Click ⚙️ on the bottom left → MCP Servers → + Add servers → Streamable HTTP:
  2. Fill the header and Key fields with { "x-consumer-api-key" = "ck_*******" }.
  3. The Key is the Composio API key, that you can find on dashboard.composio.dev
  4. Click on Authenticate and authorize Codex to your Composio account and you're all set.
Codex App MCP setup
  1. Restart and verify if it's there in .codex/config.toml
bash
[mcp_servers.composio]
url = "https://connect.composio.dev/mcp"
http_headers = { "x-consumer-api-key" = "ck_*******" }

Try it

Ask Codex for a Google Sheets task. The first time, Composio asks you to connect your Google Sheets account.

For example, ask it to:

  • "Add a new sheet named 'Q3 Sales'"
  • "Update all rows where status is 'Pending'"
  • "Create a pie chart of expenses by category"

What is the Google Sheets MCP server, and what's possible with it?

The Google Sheets MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Google Sheets account. It provides structured and secure access to your spreadsheets, worksheet data, formatting rules, and charts, so your agent can create, read, update, organize, and export spreadsheet content on your behalf.

  • Spreadsheet and worksheet creation: Have your agent create new spreadsheets, add worksheet tabs, copy sheets between spreadsheets, and rename or reorder tabs.
  • Data reading and updates: Let the agent retrieve cell ranges, append new records, update values in batches, clear ranges, and upsert rows using a key.
  • Data organization: Direct your agent to insert or delete rows and columns, sort ranges, apply filters, resize or hide dimensions, and find and replace text.
  • Rules and visual presentation: Instruct your agent to add dropdowns and other data validation rules, manage conditional formatting, and list, move, or resize charts.
  • Search and export: Have your agent find spreadsheets, inspect file details, export entire spreadsheets in supported formats, or export a worksheet or selected range as a PDF.

Conclusion

You've successfully integrated Google Sheets with Codex using Composio's MCP server. Now you can interact with Google Sheets directly from your terminal, VS Code, or the Codex App using natural language commands.

Key benefits of this setup:

  • Seamless integration across CLI, VS Code, and standalone app
  • Natural language commands for Google Sheets operations
  • Managed authentication through Composio
  • Access to 20,000+ tools across 1500+ apps for cross-app workflows
  • CodeAct workbench for complex tool chaining

Next steps:

  • Try asking Codex to perform various Google Sheets operations
  • Explore cross-app workflows by connecting more toolkits
  • Build automation scripts that leverage Codex's AI capabilities
TOOLS & TRIGGERS

Supported Tools and Triggers

Every Google Sheets action and event your agent gets out of the box.

Add Sheet to Existing Spreadsheet

Add a GRID sheet with rows and columns to an existing spreadsheet.

Aggregate Column Data

Aggregates data from a column in a Google Sheet, either across all rows or rows matching column-value filters.

Append Dimension

Tool to append new rows or columns to a sheet, increasing its size.

Auto-Resize Rows or Columns

Auto-fit column widths or row heights for a dimension range using batchUpdate.

Batch Clear Values By Data Filter

Clears one or more ranges of values from a spreadsheet using data filters.

Batch get spreadsheet

Retrieves values from specified cell ranges in a Google Spreadsheet.

Batch Update Values by Data Filter

Tool to update values in ranges matching data filters.

Clear Basic Filter

Tool to clear the basic filter from a sheet.

Clear spreadsheet values

Clears cell content (preserving formatting and notes) from a specified A1 notation range in a Google Spreadsheet; the range must correspond to an existing sheet and cells.

Create Chart in Google Sheets

Create a chart in a Google Sheets spreadsheet using a specified data range and chart type, or an optional full chart specification.

Create a Google Sheet

Creates a new Google Spreadsheet in Drive with an optional title and folder ID or exact folder name.

Create spreadsheet column

Inserts a new column in a Google Spreadsheet at a specified index.

Create spreadsheet row

Inserts a new, empty row into a specified sheet of a Google Spreadsheet at a given index, optionally inheriting formatting from the row above.

Delete Chart from Google Sheets

Delete an existing chart from a Google Sheets spreadsheet.

Delete Dimension (Rows/Columns)

Tool to delete specified rows or columns from a sheet in a Google Spreadsheet.

Delete Sheet

Tool to delete a sheet (worksheet) from a spreadsheet.

Export Drive Spreadsheet

Export an entire native spreadsheet as XLSX, ODS, PDF, ZIP, CSV, or TSV; use Export Sheet as PDF for print layout and range controls.

Export Sheet as PDF

Render one sheet tab or rectangular range as PDF with orientation, gridline, margin, and fit-to-width controls.

Find and Replace in Spreadsheet

Finds and replaces text across cells in a Google Spreadsheet, scoped to a sheet, range, or all sheets; if no scope is specified, it searches all sheets.

Format cell

Formats a specified cell range in a Google Sheets worksheet.

Get conditional format rules

List conditional formatting rules for each sheet (or a selected sheet) in a normalized, easy-to-edit form.

Get Data Validation Rules

Tool to extract data validation rules from a Google Sheets spreadsheet.

Get Drive File Metadata

Get JSON metadata for one Drive file without downloading its content.

Get sheet names

Lists all worksheet names from a specified Google Spreadsheet (which must exist), useful for discovering sheets before further operations.

Get Spreadsheet by Data Filter

Returns the spreadsheet at the given ID, filtered by the specified data filters.

Get spreadsheet info

Retrieves metadata for a Google Spreadsheet using its ID.

Insert Dimension in Google Sheet

Tool to insert new rows or columns into a sheet at a specified location.

List Charts in Google Sheets

Lists all charts in a Google Sheets spreadsheet across all sheets, returning chart_id, sheet metadata, chart type, title, and position.

List Drive Changes

Start a Drive change monitor or list one page after an existing token.

Look up spreadsheet row

Finds the first row in a specified A1 range or the first sheet where a cell matches the query after Unicode and invisible-character normalization.

Move or Resize Chart in Google Sheets

Move or resize an existing chart on a Google Sheets spreadsheet.

Move Spreadsheet to Folder

Move an existing Google Spreadsheet to a different Google Drive folder.

Mutate conditional format rules

Add, update, delete, or reorder conditional format rules on a Google Sheet.

Search Developer Metadata

Tool to search for developer metadata in a spreadsheet.

Search Spreadsheets

Search for Google spreadsheets accessible in Drive by name, content, dates, and other filters, including starred and shared-with-me status.

Set Basic Filter

Tool to set a basic filter on a sheet in a Google Spreadsheet.

Set Data Validation Rule

Tool to set or clear data validation rules (including dropdowns) on a range in Google Sheets.

Sort Range

Sorts data within a specified range in a Google Sheet based on one or more sort criteria.

Copy Sheet to Another Spreadsheet

Tool to copy a single sheet from a spreadsheet to another spreadsheet.

Append Values to Spreadsheet

Tool to append values to a spreadsheet.

Batch Clear Spreadsheet Values

Tool to clear one or more ranges of values from a spreadsheet.

Batch Get Spreadsheet Values by Data Filter

Retrieves one or more ranges of values from a Google Spreadsheet using data filters.

Update Chart in Google Sheets

Updates an existing chart in a Google Sheets spreadsheet by replacing its chart specification.

Update Dimension Properties (Hide/Unhide & Resize)

Tool to hide/unhide rows or columns and set row heights or column widths.

Update Sheet Properties

Tool to update properties of a sheet (worksheet) within a Google Spreadsheet, such as its title, index, visibility, tab color, or grid properties.

Update Spreadsheet Properties

Tool to update SPREADSHEET-LEVEL properties such as the spreadsheet's title, locale, time zone, or auto-recalculation settings.

Batch update spreadsheet values

Tool to set values in one or more ranges of a spreadsheet.

Upsert Rows (Smart Update/Insert)

Upserts rows in a Google Sheet by matching a key column: updates matching rows and appends new ones.

Get spreadsheet values

Returns a range of values from a spreadsheet.

Update spreadsheet values

Sets or overwrites values in a Google Spreadsheet range, adjusting the range to fit the supplied values and potentially expanding the sheet by default.

FAQ

Frequently asked questions

With a standalone Google Sheets MCP server, the agents and LLMs can only access a fixed set of Google Sheets tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Google Sheets and many other apps based on the task at hand, all through a single MCP endpoint.

Yes, you can. Codex fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Google Sheets tools.

Yes, absolutely. 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.

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Google Sheets data and credentials are handled as safely as possible.

Start with Google Sheets.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Google Sheets tool your agent needs.Free to start.

Start building