---
title: "Connect Google Sheets to an AI-built tool, no key in the code"
url: https://while.sh/en/guides/connect-google-sheets-ai-tool/
author: "Aloïs Oddon, co-founder of Nextmap"
updated: 2026-11-18
---

# Connect Google Sheets to a tool built with Claude or ChatGPT (2026)

Your tool built with Claude needs to read or fill in a Google Sheet the team already knows. The usual path goes through a service account and a credentials file, which you should never paste into the code or the conversation. On while, it stays in while. Here is how.

Many small business tools start as a Google Sheet, and many need to keep reading it: the client list, the stock, the schedule. A tool built with Claude or ChatGPT can do it, as long as it has a Google credential. The usual path goes through **a service account** and its **credentials file**, a file you should paste **neither into the code nor into the conversation**.

On while, that file **stays in while**. The tool calls Google without ever holding it, and your AI never sees it.

> **The short version.** Create a service account in the Google Cloud console and its credentials file, share the sheet with the service account's address, ask your AI to connect Google, then paste the file into while through the link it gives you.

## Connect Google Sheets to your tool, in five steps

The whole thing takes a few minutes, and you do not have to write a line of code.

1. **Create a service account.** In the Google Cloud console, open IAM & Admin, then Service Accounts, and create one in your project (source 1). Also enable the Google Sheets API in that project.
2. **Create its credentials file.** In the service account, open the Keys tab, add a new one, and choose the JSON format. **Google only gives you this file once** (source 1).
3. **Share the sheet with the service account.** Open the sheet, click Share, and add the service account's address, as a viewer or an editor, as you would for a person. Uncheck the notification: the service account has no inbox (source 1).
4. **Ask your AI to connect Google.** It declares the connection in while and gives you a link.
5. **Paste the file into while.** You open the link, paste the file's content and confirm. Neither your AI nor the tool's code sees it.

> You, to your AI: Connect our Google Sheet of orders to this tool, so it reads today's orders and adds the ones the team enters.

<figure class="illus"><img src="/illustrations/sheets-partage-1200.webp" srcset="/illustrations/sheets-partage-768.webp 768w, /illustrations/sheets-partage-1200.webp 1200w" sizes="(min-width: 48rem) 46rem, 100vw" width="1536" height="1024" loading="lazy" decoding="async" alt="Share a Google Sheet with a service account so a tool built with AI reads it through while: the sheet's rows go through while, which adds the credential and logs each call" /><figcaption>The sheet is shared with the service account, and the tool reads it through while.</figcaption></figure>

## What while does on each call

The tool calls Google **through while**, without a credential. while signs each call with the service account file, and logs it. For the first seven days, reads go through and help learn what the tool calls. **A write**, like adding a row, goes through as soon as you approve its rule. After that, an unexpected call is refused, and your AI is notified.

Sharing the sheet and while's rules add up: the tool only reads the sheets shared with the service account, and only writes what you allowed. The same mechanism works for any API in [connect an API without a credential in the code](/en/guides/api-keys-out-of-code/).

## What while brings around it

- **Your colleagues** use the tool with a while account for up to 3 people, or, on the Pro plan, with their email account, Google or Microsoft. See [keep a tool for your colleagues](/en/guides/internal-tool-company-sign-in/).
- **Connected software**: one on the Free plan, and 25 on the Pro plan.
- **The tool's data** is backed up every day, and your tools are hosted in France by Nextmap.

If the sheet has become the tool itself, read [replace a shared Excel file with a tool built with AI](/en/guides/replace-shared-excel-file-ai-tool/) instead, and for other connections, [Notion](/en/guides/connect-notion-ai-tool/) or [HubSpot](/en/guides/connect-hubspot-ai-tool/).

## Try it with your tool

Give this message to your AI, then ask it to connect your sheet. The trial is **free, with no sign-up**, and your tool has its address **in 3 minutes**.

```text titre="The message to give your AI"
Read while.sh/agents and help me get started with while.
```

## Sources

1. [Google Workspace, Create access credentials](https://developers.google.com/workspace/guides/create-credentials), 2026-11-18

## Questions

### How do you give a tool access to a Google Sheet?

With a service account: create it in the Google Cloud console, create its JSON credentials file, then share the sheet with its address, as you would with a person (source 1).

### Do you need to be a Google Workspace admin?

No. Sharing a sheet with the service account requires no admin rights (source 1).

### Does my AI see the credentials file?

No. Your AI declares the Google connection and gives you a link. You paste the file's content there, in while, and neither your AI nor the tool's code sees it.

### What if I lose the JSON file?

Google only gives it once: you need to create a new one in the console, then paste it into while. The tool uses it from the next call (source 1).

### Can the tool write to the sheet?

Yes, if the sheet is shared with the service account as an editor. On while, a write goes through as soon as you approve its rule.
