← Back to Home

Ai for Sheets.

Published Jun 6, 2026 — AI for Sheets

How to Use Claude in Google Sheets (Step-by-Step Guide)

Google Sheets is powerful. Claude is one of the most capable AI models available right now. Combine them and you can write formulas in plain English, clean messy data, summarize long text, and automate tasks that used to take hours.

This guide shows you exactly how to use Claude in Google Sheets, from the quickest free setup to a full integration that works across your spreadsheet.

What Is Claude?

Claude is an AI assistant built by Anthropic. Like ChatGPT, you can have a conversation with it, ask it to write things, explain things, or work with data. Claude also supports a large context window, which helps when your spreadsheet tasks involve long text or lots of rows.

Claude is available in several tiers:

ModelAPI IDBest for
Claude Haiku 4.5claude-haiku-4-5-20251001Fast, low-cost, simple tasks
Claude Sonnet 4.6claude-sonnet-4-6Best speed and quality balance
Claude Opus 4.8claude-opus-4-8Complex reasoning and long outputs

For most Google Sheets workflows, Claude Sonnet 4.6 is the practical starting point.

Option 1: Use Claude.ai Alongside Your Sheet (Free, No Setup)

The easiest method requires no installation.

  1. Open your spreadsheet in one tab
  2. Open claude.ai in another tab
  3. Copy your data, paste into Claude, and ask your question

This works well for one-off tasks:

Limitation: copy-paste is manual each time, and responses do not update automatically when data changes.

Option 2: Claude for Sheets (Official Anthropic Add-on)

Anthropic offers an official Google Sheets add-on called Claude for Sheets. It gives you a =CLAUDE() function without writing Apps Script yourself.

You still need your own Anthropic API key from console.anthropic.com.

Setup

  1. Install Claude for Sheets from the Workspace Marketplace
  2. Go to Extensions and open the Claude for Sheets sidebar
  3. Paste your API key
  4. Use =CLAUDE() in any cell

Best for: no-code users who want quick setup and Claude-only workflows.

Limitation: tied to Anthropic models and API billing after free credits are used.

Option 3: Connect Claude via Apps Script (Full Control)

If you want custom behavior, model switching, or tighter control over errors and costs, call Anthropic directly from Google Apps Script.

What you need

Step 1: Create an API key

  1. Go to console.anthropic.com
  2. Sign in and open API Keys
  3. Create a key and copy it

Step 2: Open Apps Script

  1. Open your Google Sheet
  2. Click Extensions then Apps Script

Step 3: Add the Claude function

Replace the default code with:

const ANTHROPIC_API_KEY = "YOUR_API_KEY_HERE";
const CLAUDE_MODEL = "claude-sonnet-4-6";

function CLAUDE(prompt) {
  if (!prompt) return "";

  const payload = {
    model: CLAUDE_MODEL,
    max_tokens: 1024,
    messages: [{ role: "user", content: String(prompt) }]
  };

  const options = {
    method: "post",
    contentType: "application/json",
    headers: {
      "x-api-key": ANTHROPIC_API_KEY,
      "anthropic-version": "2023-06-01"
    },
    payload: JSON.stringify(payload),
    muteHttpExceptions: true
  };

  const response = UrlFetchApp.fetch("https://api.anthropic.com/v1/messages", options);
  const json = JSON.parse(response.getContentText());

  if (json.error) return "Error: " + json.error.message;
  return json.content[0].text.trim();
}

Step 4: Save and authorize

  1. Save the script
  2. In your sheet, run =CLAUDE("say hello")
  3. Complete the Google authorization prompt

Useful Claude Prompts in Sheets

Write formulas from plain English

=CLAUDE("Write a Google Sheets formula that calculates percentage change between " & A2 & " and " & B2 & ". Return only the formula.")

Summarize text

=CLAUDE("Summarize this customer feedback in one sentence: " & C2)

Classify values

=CLAUDE("Classify this expense as Travel, Software, Marketing, or Operations. Reply with one category only: " & D2)

Translate content

=CLAUDE("Translate to Spanish. Reply only with the translation: " & E2)

Extract structured info

=CLAUDE("Extract only the email address from this text. If none found, reply not found: " & F2)

Tips for Better Results

Claude vs. ChatGPT vs. Gemini in Google Sheets

Claude (Sonnet 4.6)ChatGPT (GPT-4.1)Gemini
API requiredYesYesYes or Workspace plan
Free tierSignup creditsSignup creditsGenerous API free tier
Best atLong context and nuanced text tasksBroad general useNative Google integration
Context windowLargeLargeLarge

Frequently Asked Questions

Is Claude free to use in Google Sheets?

Anthropic typically offers starter credits for new API users. After credits are used, billing is pay-as-you-go.

Is data sent to Claude used for training?

Anthropic states that API data is not used for training by default. Review the latest Anthropic privacy policy before sending sensitive information.

Why does my =CLAUDE() formula error out?

Common causes: invalid API key, missing script authorization, rate limiting, or output length limits.

Should I use the add-on or Apps Script?

Use the official add-on for speed and simplicity. Use Apps Script when you need custom logic, stronger error handling, or multi-model workflows.

Download the GPT Apps Script

Paste it into Apps Script, add your OpenAI API key, then use the OpenAI menu in Google Sheets to run Generate Content on the selected cell.

Send Feedback