File: claude-for-sheets.md | Updated: 11/15/2025
Agent Skills are now available! Learn more about extending Claude's capabilities with Agent Skills .
English
Search...
Ctrl K
Search...
Navigation
Capabilities
Google Sheets add-on
Home Developer Guide API Reference Model Context Protocol (MCP) Resources Release Notes
On this page
Claude for Sheets enables prompt engineering at scale by enabling you to test prompts across evaluation suites in parallel. Additionally, it excels at office tasks like survey analysis and online data processing. Visit our prompt engineering example sheet to see this in action.
Install Claude for Sheets
Easily enable Claude for Sheets using the following steps:
1
Get your Claude API key
If you don’t yet have an API key, you can make API keys in the Claude Console .
2
Install the Claude for Sheets extension
Find the Claude for Sheets extension
in the add-on marketplace, then click the blue Install btton and accept the permissions.
Permissions
The Claude for Sheets extension will ask for a variety of permissions needed to function properly. Please be assured that we only process the specific pieces of data that users ask Claude to run on. This data is never used to train our generative models.Extension permissions include:
3
Connect your API key
Enter your API key at Extensions > Claude for Sheets™ > Open sidebar > ☰ > Settings > API provider. You may need to wait or refresh for the Claude for Sheets menu to appear.
You will have to re-enter your API key every time you make a new Google Sheet
Enter your first prompt
There are two main functions you can use to call Claude using Claude for Sheets. For now, let’s use CLAUDE().
1
Simple prompt
In any cell, type =CLAUDE("Claude, in one sentence, what's good about the color blue?")
Claude should respond with an answer. You will know the prompt is processing because the cell will say
Loading...
2
Adding parameters
Parameter arguments come after the initial prompt, like =CLAUDE(prompt, model, params...).
model is always second in the list.
Now type in any cell =CLAUDE("Hi, Claude!", "claude-3-haiku-20240307", "max_tokens", 3)Any API parameter
can be set this way. You can even pass in an API key to be used just for this specific cell, like this: "api_key", "sk-ant-api03-j1W..."
CLAUDEMESSAGES is a function that allows you to specifically use the Messages API
. This enables you to send a series of User: and Assistant: messages to Claude. This is particularly useful if you want to simulate a conversation or prefill Claude’s response
. Try writing this in a cell:
Copy
=CLAUDEMESSAGES("User: In one sentence, what is good about the color blue?
Assistant: The color blue is great because")
NewlinesEach subsequent conversation turn (User: or Assistant:) must be preceded by a single newline. To enter newlines in a cell, use the following key combinations:
Example multiturn CLAUDEMESSAGES() call with system prompt
To use a system prompt, set it as you’d set other optional function parameters. (You must first set a model name.)
Copy
=CLAUDEMESSAGES("User: What's your favorite flower? Answer in <answer> tags.
Assistant: <answer>", "claude-3-haiku-20240307", "system", "You are a cow who loves to moo in response to any and all user queries.")`
Optional function parameters
You can specify optional API parameters by listing argument-value pairs. You can set multiple parameters. Simply list them one after another, with each argument and value pair separated by commas.
The first two parameters must always be the prompt and the model. You cannot set an optional parameter without also setting the model.
The argument-value parameters you might care about most are:
| Argument | Description |
| --- | --- |
| max_tokens | The total number of tokens the model outputs before it is forced to stop. For yes/no or multiple choice answers, you may want the value to be 1-3. |
| temperature | the amount of randomness injected into results. For multiple-choice or analytical tasks, you’ll want it close to 0. For idea generation, you’ll want it set to 1. |
| system | used to specify a system prompt, which can provide role details and context to Claude. |
| stop_sequences | JSON array of strings that will cause the model to stop generating text if encountered. Due to escaping rules in Google Sheets™, double quotes inside the string must be escaped by doubling them. |
| api_key | Used to specify a particular API key with which to call Claude. |
Example: Setting parameters
Ex. Set system prompt, max_tokens, and temperature:
Copy
=CLAUDE("Hi, Claude!", "claude-3-haiku-20240307", "system", "Repeat exactly what the user says.", "max_tokens", 100, "temperature", 0.1)
Ex. Set temperature, max_tokens, and stop_sequences:
Copy
=CLAUDE("In one sentence, what is good about the color blue? Output your answer in <answer> tags.","claude-opus-4-20250514","temperature", 0.2,"max_tokens", 50,"stop_sequences", "\[""</answer>""\]")
Ex. Set api_key:
Copy
=CLAUDE("Hi, Claude!", "claude-3-haiku-20240307","api_key", "sk-ant-api03-j1W...")
Prompt engineering interactive tutorial
Our in-depth prompt engineering interactive tutorial utilizes Claude for Sheets. Check it out to learn or brush up on prompt engineering techniques.
Just as with any instance of Claude for Sheets, you will need an API key to interact with the tutorial.
Prompt engineering workflow
Our Claude for Sheets prompting examples workbench is a Claude-powered spreadsheet that houses example prompts and prompt engineering structures.
Claude for Sheets workbook template
Make a copy of our Claude for Sheets workbook template to get started with your own Claude for Sheets work!
NAME? Error: Unknown function: 'claude'

#ERROR!, ⚠ DEFERRED ⚠ or ⚠ THROTTLED ⚠
You can manually recalculate #ERROR!, ⚠ DEFERRED ⚠ or ⚠ THROTTLED ⚠cells by selecting from the recalculate options within the Claude for Sheets extension menu.
Can't enter API key
For more information regarding this extension, see the Claude for Sheets Google Workspace Marketplace overview page.
Was this page helpful?
YesNo
Assistant
Responses are generated using AI and may contain mistakes.


