This post was generated by an AI agent from an article the account owner published in Japanese on note. The wording is not human-written.

In one workflow, Claude Code (the VS Code extension) was being used to export data into Excel, but sharing those files with a client meant manually uploading them to Google Drive every time. That repetitive step led to a question: what if Claude could write straight to a Google Spreadsheet instead?

The answer was a custom MCP server. Once it was built, Claude Code could create, read, write, format, and share Google Sheets just by being asked in natural language from within VS Code.

Setup used

  • Claude Code (VS Code extension)
  • Node.js v22
  • Windows 11
  • A Google Cloud project (free tier)
  • TypeScript

What MCP is doing here

Model Context Protocol (MCP) is a way to give an AI assistant new tools. Claude Code can normally read/write files and run terminal commands, but it has no built-in way to manipulate Google Sheets. Adding an MCP server effectively installs a new skill — in this case, a "Sheets operations" plugin — that Claude can call into.

The server: 9 tools

The MCP server built for this exposes nine tools, split into three groups.

Spreadsheet management:

  • Create a new spreadsheet
  • Delete a spreadsheet
  • List spreadsheets in Google Drive
  • List sheet tabs
  • Add a sheet tab

Data operations:

  • Read data (with pagination support)
  • Write data (supports CSV / TSV / JSON, overwrite or append)

Formatting and sharing:

  • Cell formatting (bold, color, borders, alignment, etc.)
  • Sharing with other users

What using it looks like

The interaction is just natural-language requests to Claude:

  • "Create a spreadsheet called 'Sales Management' and put in the following data" — Claude creates the sheet, writes the data, and returns the URL.
  • "Make row 1 of this spreadsheet bold and set the background color to light blue" — formatting handled directly.
  • "Share this spreadsheet with partner@example.com with viewer permission" — sharing handled by the AI as well.

Where it got stuck

Authentication was the biggest obstacle. The first implementation used a service account, but it turned out that a personal Google account isn't allocated Drive storage under that method, so spreadsheets couldn't actually be created. That required rewriting the authentication layer entirely to use OAuth2 instead. The lesson from this: the choice of authentication method deserves careful research up front, before building around it.

A second, smaller issue came up during builds: Dropbox would lock files when its sync happened to overlap with a build, causing build errors. The workaround was adding a short wait before the build step to avoid the collision.

Results

What worked:

  • Creating, reading/writing, formatting, and sharing spreadsheets from VS Code, entirely through natural language
  • Publishing the server to npm so anyone can install it
  • Noticeably easier data sharing with clients

What didn't work:

  • Chart creation (difficult due to Sheets API limitations)
  • Cell merging (not implemented, possibly later)

In practice, the three-step flow of "create the sheet," "put in the data," and "share it," done entirely through conversation with the AI, turned out to be a notably smooth experience. Since it works alongside the existing Excel export, internal data can stay in Excel while anything shared externally goes through Google Sheets — letting both formats be used where they fit best.

Summary

  • A custom MCP server now lets Claude Code operate Google Sheets directly
  • It supports 9 tools covering read/write, creation, deletion, formatting, and sharing
  • Authentication method should be chosen carefully upfront — the service account approach has a storage-allocation trap for personal accounts
  • The package is already published on npm and ready to use: https://www.npmjs.com/package/@beatmaster/google-sheets-mcp

Follow @kmrb_works here on DEV for more field notes from real development work. Also on X and note, mostly in Japanese.