Claude for Google Sheets: Run Claude on Every Row

Sanskar Tiwari

Published By

Founder, SheetAI · Amazon author·sanskartiwari.io

Updated on ·12 min read

How to use Claude for Google Sheets with a formula: add your Anthropic API key, pick Haiku, Sonnet or Opus per task, and fill whole columns with SheetAI.

Claude for Google Sheets: Who This Is For

If you want Claude for Google Sheets, you probably have a column of text and a job to do on each row. Support replies that need a calmer tone, customer feedback that is too long to read, tickets that need a label, a list of leads that needs a personal first line. Pasting rows into a chat window one at a time does not scale past a handful.

The approach in this guide is to put Claude inside a formula. You write the prompt once in the first row, reference the cell that holds your text, and drag the formula down. Every row gets its own answer, and the answers sit in normal cells you can filter, sort and share.

I will cover how to get an Anthropic API key, how to connect it to Google Sheets with SheetAI, which Claude model to pick for which job, four worked examples, how to mix Claude with other models in one sheet, and how to keep the cost under control. If you already use ChatGPT in Sheets, the ChatGPT guide follows the same pattern, so most of this will feel familiar.

What You Need

Two things: the SheetAI add-on and an Anthropic API key.

  1. Install SheetAI from the Google Workspace Marketplace. It works in Google Sheets only, not in Microsoft Excel.
  2. Get an API key from Anthropic (steps below), or use a hosted plan if you would rather not manage a key. Hosted plans start at $12/month, details on the pricing page.

With your own key, SheetAI itself is free and you pay Anthropic directly for what you use. That is the setup this post assumes.

Step 1: Get an Anthropic API Key

The Claude chat app and the Claude API are billed separately. A chat subscription does not give you an API key, so you need to set up API access on its own.

  1. Go to console.anthropic.com and sign in or create an account.
  2. Add billing details and a small amount of credit. The API is pay as you go.
  3. Open the API keys section and create a new key. Give it a name such as "sheetai".
  4. Copy the key straight away. You usually cannot view it again later.

Treat the key like a password. Anyone who has it can spend your credit. If you share the sheet, remember that the key lives in your SheetAI settings, not in the cells, so collaborators do not see it in the sheet.

Step 2: Paste the Key into the SheetAI Sidebar

  1. Open your Google Sheet and choose Extensions > SheetAI App > Launch. The sidebar opens on the right.
  2. Open the settings in the sidebar and find the Anthropic (Claude) key field.
  3. Paste your key and save.

That is the whole connection. The Anthropic models page in the docs lists the current options if you want the detail.

Step 3: Choose the Claude Model with the Fourth Argument

The core function is:

=SHEETAI(prompt, [max_tokens], [temperature], [model])

The defaults are 1000 tokens and a temperature of 0.4. The fourth argument picks the model, and three codes cover Claude:

CodeModelUse it for
"c3h"Claude HaikuBulk classification, short labels, quick extraction
"c3s"Claude SonnetWriting, rewriting, summaries, the sensible default
"c3"Claude OpusLong, nuanced analysis where you want the most careful reading

A simple rule I follow: start with Sonnet. If the job is a short, repetitive label across many rows, move down to Haiku and check a sample. If the job is a long document with subtle points, move up to Opus and accept the higher cost per row. Do not use Opus for a column of one-word labels, because you are paying for depth the task does not need.

Here is the first example, rewriting support replies in a set tone, with Sonnet.

=SHEETAI("Rewrite this support reply so it is warm, calm and under 60 words. Keep every fact. Reply: "&A2, 300, 0.4, "c3s")
Support replies
B2fx=SHEETAI("Rewrite this support reply so it is warm, calm and under 60 words. Keep every fact. Reply: "&A2, 300, 0.4, "c3s")
AB
1Draft replyRewritten reply
2Your refund is processed. It takes 5 days. Stop emailing about it.Your refund has been processed and should reach you within 5 days. If it has not arrived by then, reply here and we will look into it straight away.
3We do not support that file type. Use PDF.Sorry, we cannot open that file type yet. Could you send it as a PDF? That format works every time.
4Password reset link expired, request again.The reset link has expired, which happens after a short while. Please request a new one and use it soon after it arrives.
5Your order shipped Monday. Check tracking.Good news, your order left us on Monday. You can follow it with the tracking link in your confirmation email.
6No we cannot change the address after dispatch.Unfortunately we cannot change the address once an order has been dispatched. If it comes back to us, we will gladly resend it to the right place.
Drafts
One formula in B2, dragged down. The tone instruction lives in the prompt, so every row gets the same voice.

Notice that the prompt says "keep every fact". Without a line like that, a rewrite can quietly soften or drop a detail, such as a time frame. Read a sample of rows before sending anything to a customer.

Step 4: Fill the Column in Batches

Type the formula in B2, then drag the fill handle down. Google Sheets custom functions time out after about 30 seconds per cell, and a long column makes many calls at once, so fill 50 to 100 rows at a time rather than 5,000 in one go. Results are cached, so the same prompt on the same text is not billed twice.

More Worked Examples

Summarise Long Customer Feedback

Survey comments and review exports often hold paragraphs. Sonnet handles this well, and max_tokens keeps the output short.

=SHEETAI("Summarise this customer feedback in one sentence, then give the main complaint or request in 5 words. Feedback: "&A2, 150, 0.2, "c3s")
Feedback export
B2fx=SHEETAI("Summarise this customer feedback in one sentence, then give the main complaint or request in 5 words. Feedback: "&A2, 150, 0.2, "c3s")
AB
1FeedbackSummary
2I love the app overall but exporting to PDF crops the right edge of every table and I have to fix it by hand each week before sending to my boss.Customer likes the app but PDF exports crop tables. Main issue: PDF export crops tables.
3Support answered quickly which was great. The price went up at renewal without a warning email though, and I only noticed on my card statement.Fast support, but the renewal price rose without notice. Main issue: no price change warning.
4Wish there was a dark mode. I work late and the white screen is rough.Customer works late and wants a dark mode. Main request: add a dark mode.
5Setup took ten minutes and everything worked. Nothing to add.Setup was quick and trouble free. Main request: none.
6The mobile version keeps logging me out every few hours so I stopped using it on the train.Mobile app logs the user out repeatedly. Main issue: frequent mobile logouts.
Responses
Low temperature (0.2) keeps summaries factual and consistent.

For feedback that is long and contradictory, such as interview transcripts, switch the last argument to "c3" and ask for themes and the evidence for each. Opus costs more per row, so run it on the few rows that need it, not the whole export.

Classify Tickets with Haiku

Labelling is the job where the smallest model usually does fine, and it is the one you repeat on thousands of rows. Set temperature to 0 and a tiny max_tokens so the answer is just the label.

=SHEETAI("Classify this support ticket as exactly one of: Billing, Bug, How-to, Feature request, Other. Reply with the label only. Ticket: "&A2, 10, 0, "c3h")
Ticket triage
B2fx=SHEETAI("Classify this support ticket as exactly one of: Billing, Bug, How-to, Feature request, Other. Reply with the label only. Ticket: "&A2, 10, 0, "c3h")
AB
1TicketCategory
2I was charged twice this monthBilling
3The export button does nothing when I click itBug
4How do I add a teammate to my account?How-to
5Can you add a Slack integration?Feature request
6Do you have a partner programme?Other
7Invoice shows the wrong company nameBilling
Inbox
Haiku with temperature 0 and a 10 token limit: short, repeatable labels.

If you do not need a specific model, =SHEETAI_CLASSIFY(text, "Billing, Bug, How-to") does the same job with less prompt writing. The guide on classifying data automatically in Google Sheets covers it. Use the model argument version when you want Haiku specifically, or when your labels need a longer definition.

Draft Outreach First Lines

A personal first line is the part of a cold email people skip because it takes time. Give Claude the facts you have in the sheet and nothing else.

=SHEETAI("Write one friendly opening sentence for a cold email to "&A2&", who is "&B2&" at "&C2&". Mention only what I have given you. Do not flatter. Under 25 words.", 80, 0.6, "c3s")
Outreach list
D2fx=SHEETAI("Write one friendly opening sentence for a cold email to "&A2&", who is "&B2&" at "&C2&". Mention only what I have given you. Do not flatter. Under 25 words.", 80, 0.6, "c3s")
ABCD
1NameRoleCompanyFirst line
2Anita RaoHead of OperationsNorthwind LogisticsAnita, I noticed you run operations at Northwind Logistics, so I will keep this short.
3Tom BeckerFounderBecker BikesTom, as the founder of Becker Bikes you probably read every email yourself, so here is a brief one.
4Lucia FernandezMarketing ManagerBrightleaf TeaLucia, I am writing to the marketing team at Brightleaf Tea with one specific idea.
5Sam OkaforFinance LeadHarbour StudioSam, finance leads at studios like Harbour Studio often ask me about the same spreadsheet problem.
6Priya MenonCustomer Success LeadLoomly HomePriya, I am reaching out about customer success at Loomly Home with a short question.
Leads
The prompt only allows facts from columns A to C, which stops the model inventing details about the person.

The "mention only what I have given you" line matters. If Claude is allowed to guess, it will invent a recent award or a podcast appearance that never happened. Always read these before sending.

Mixing Claude with Other Models in One Sheet

You are not locked to one provider. Because the model is just the fourth argument, you can use different models in different columns of the same sheet. A setup I like for a support sheet:

  • Column B, ticket category: Haiku ("c3h"), cheap and fast.
  • Column C, draft reply: Sonnet ("c3s"), better prose.
  • Column D, English translation for the team: =SHEETAI_TRANSLATE(A2, "english").
  • Column E, a quick check using a different model, such as =SHEETAI("Does this reply contain any promise we cannot keep? Yes or No. "&C2, 10, 0, "4o-m").

Using a second model as a checker is a reasonable habit, because two models rarely make the same mistake in the same place. It is not a guarantee, so you still read a sample. Other available codes include "4o" for GPT-4o, "g" for Gemini Flash and "grok-3" for Grok. Each needs its own key in the sidebar.

Keeping the Cost Under Control

With your own key you pay per token, so a few habits matter.

  • Set max_tokens. The second argument caps the length of the answer. A label needs 10 tokens, a summary 150, a draft email 300. The default is 1000, which is more than most cells need.
  • Use Haiku for bulk. If the task is a label, a yes or no, or a short extraction, try Haiku first and compare a sample against Sonnet.
  • Lean on caching. Results are cached, so the same prompt with the same text does not get billed twice. Changing the prompt wording changes the cache key, so settle your prompt on five rows before you fill the whole column.
  • Freeze finished columns. Copy the column, then use Paste special > Values only. That turns formulas into plain text so they never recalculate. There is a full explanation in how to prevent formula recalculation.
  • Filter before you fill. Do not run a column on blank or irrelevant rows. Wrap the formula in =IF(A2="","",SHEETAI(...)).

Prompt Tips for Claude in Sheets

  • Say exactly what the output should look like: "Reply with the label only" or "Under 25 words".
  • Give a closed list of options for classification, and spell the labels the way you want them back.
  • Put the cell reference last, after the instructions, so the instruction is not buried in a long text.
  • Use temperature 0 to 0.2 for labels and summaries, and 0.5 to 0.7 for creative writing.
  • Tell it what not to do. "Do not invent facts" and "do not flatter" cut common problems.
  • The model only sees what is in the cells you reference. If the answer depends on a policy document, put the relevant policy text in the prompt.

Other Ways to Use Claude with a Spreadsheet

SheetAI is not the only route. Anthropic also publishes its own "Claude for Sheets" add-on, which adds a CLAUDE formula that uses your API key. The Claude chat app can read a spreadsheet you upload and answer questions about it, but it cannot fill a live column in your sheet for you. Which one fits depends on whether you want one answer about a file or a formula that runs on every row.

When Not to Use This

  • Arithmetic. Sums, averages and percentages belong in normal formulas. They are instant and always right.
  • Very long columns in one go. Because of the roughly 30 second limit per cell, fill in batches.
  • Anything that needs to be exactly right. Spot-check the output, especially for customer-facing text, legal wording and numbers.
  • Facts the sheet does not contain. The model sees only the cells you reference, so it can guess at anything else.
  • Microsoft Excel. SheetAI runs in Google Sheets only.

Frequently Asked Questions

How do I use Claude in Google Sheets?

Install SheetAI, add your Anthropic API key in the sidebar settings, then use =SHEETAI("your prompt "&A2, 300, 0.4, "c3s") in a cell and drag it down. The fourth argument selects Claude Sonnet.

Which Claude model should I use for Sheets?

Use Haiku ("c3h") for bulk classification and short labels, Sonnet ("c3s") as the default for writing and summaries, and Opus ("c3") for long, nuanced analysis. Start with Sonnet and move up or down after checking a sample.

Do I need an Anthropic API key?

Yes, if you use the free version of SheetAI. You create the key at console.anthropic.com and pay Anthropic for what you use. If you do not want to manage a key, hosted plans start at $12/month, listed on the pricing page.

Can I use Claude and ChatGPT in the same sheet?

Yes. Use the model argument to pick a model per column, for example "c3s" for Claude Sonnet and "4o-m" for GPT-4o mini. Each provider needs its own key in the sidebar. The ChatGPT guide covers the OpenAI side.

Is there a Claude for Sheets option that is not SheetAI?

Yes. Anthropic publishes its own Claude for Sheets add-on that adds a CLAUDE formula using your API key. SheetAI adds extra functions such as classify, extract and translate, and lets you switch between providers in one sheet.

Try It on a Small Column First

Install SheetAI, paste your key, and run one of the formulas above on five rows before you fill the rest. The get started page walks through the first run, and the SheetAI docs list every function.

About the author

Sanskar Tiwari profile photo
Sanskar Tiwari— Founder, SheetAI · Amazon author

sanskartiwari.io·Amazon author

Sanskar Tiwari is the founder of SheetAI and IndianAppGuy Tech. He has built 25+ productivity products (including MagicSlides and SheetAI), serving millions of users, and is a published Amazon author. He writes practical Google Sheets and AI automation guides for marketers, analysts, and operators.

Claude for Google Sheets: Run Claude on Every Row