# Using Claude Code with Google Sheets

DevFeed: [Using Claude Code with Google Sheets](<https://devfeed.tech/articles/using-claude-code-with-google-sheets-20520.md>)

Original publisher: [Read original article](<https://code.dblock.org/2025/07/30/using-claude-code-with-google-sheets.html>)

Author: Daniel Doubrovkine (dblock@dblock.org)

Published: 2025-07-30T01:00:00Z

Content type: tutorial

Language: en

Sources: [Daniel Doubrovkine](<https://devfeed.tech/sources/daniel-doubrovkine.md>)

Topics: [Claude Code](<https://devfeed.tech/topics/claude-code.md>), [cURL](<https://devfeed.tech/topics/curl.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [analyze](<https://devfeed.tech/tags/analyze.md>), [api](<https://devfeed.tech/tags/api.md>), [auth](<https://devfeed.tech/tags/auth.md>), [authorization](<https://devfeed.tech/tags/authorization.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [cli](<https://devfeed.tech/tags/cli.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [connect](<https://devfeed.tech/tags/connect.md>), [console](<https://devfeed.tech/tags/console.md>), [curl](<https://devfeed.tech/tags/curl.md>), [distribution](<https://devfeed.tech/tags/distribution.md>), [drive](<https://devfeed.tech/tags/drive.md>), [google](<https://devfeed.tech/tags/google.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [google-drive](<https://devfeed.tech/tags/google-drive.md>), [google-sheets](<https://devfeed.tech/tags/google-sheets.md>), [install](<https://devfeed.tech/tags/install.md>), [project](<https://devfeed.tech/tags/project.md>), [spreadsheet](<https://devfeed.tech/tags/spreadsheet.md>), [tools](<https://devfeed.tech/tags/tools.md>)

## AI overview

To connect Claude Code to Google Sheets, create a Google Cloud project, enable the Google Sheets API, install the Google Cloud CLI, select the project with `gcloud config set project`, and authenticate with Google Drive access using `gcloud auth login --enable-gdrive-access`. The excerpt shows retrieving sheet values with an authenticated `curl` request, then asking Claude Code to analyze the sample spreadsheet. It identifies two common errors: an unregistered-caller error requires an access token, and an insufficient-authentication-scopes error requires a project with Sheets access and login with Drive access enabled. The excerpt does not provide the missing commands in its troubleshooting section.

## Source excerpt

Let's get Claude Code to connect to Google Sheets. We'll use this Google Sample Spreadsheet. Go to the Google Cloud Console, create a new project, and enable the Google Sheets API on it. Install the Google Cloud CLI. brew install google-cloud-sdk Choose the newly created project on the command line. ~$ gcloud config set project gsheetscli Updated property [core/project]. Login again, but this time enable Google Drive access. gcloud auth login --enable-gdrive-access You can now access the spreadsheet with curl. curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/Class%20Data" { "range": "'Class Data'!A1:V101", "majorDimension": "ROWS", "values": [ [ "Student Name", "Gender", "Class Level", "Home State", "Major", "Extracurricular Activity" ], ... ] } Let's ask Claude to do something useful. Let's ask Claude to do something useful. ~$ claude ╭───────────────────────────────────────────────────╮ │ ✻ Welcome to Claude Code! │ ╰───────────────────────────────────────────────────╯ > analyze the distribution of extracurricular activities in https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit?gid=0#gid=0 ⏺ I'll analyze the distribution of extracurricular activities from the Google Sheets document you provided. ⏺ Fetch(https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit?gid=0#gid=0) ⎿ Received 193.5KB (200 OK) ⏺ The extracurricular activities distribution shows perfect balance: Activity Distribution: - Drama Club: 5 students (16.7%) - Basketball: 5 students (16.7%) - Debate: 5 students (16.7%) - Lacrosse: 5 students (16.7%) - Baseball: 5 students (16.7%) - Track & Field: 5 students (16.7%) Total: 30 students across 6 activities Each activity has exactly 5 students participating, resulting in an even distribution with no activity being more popular than others in this dataset. Whoa. Troubles