Why use Claude for Sheets?
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.Get started with Claude for Sheets
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
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:
- View and manage spreadsheets that this application has been installed in: Needed to run prompts and return results
- Connect to an external service: Needed in order to make calls to Claude API endpoints
- Allow this application to run when you are not present: Needed to run cell recalculations without user intervention
- Display and run third-party web content in prompts and sidebars inside Google applications: Needed to display the sidebar and post-install prompt
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 useCLAUDE()
.
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 Now type in any cell
=CLAUDE(prompt, model, params...)
.
model
is always second in the list.=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..."
Advanced use
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:
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:- Mac: Cmd + Enter
- Windows: Alt + Enter
Example multiturn CLAUDEMESSAGES() call with system prompt
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.)
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.
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
Example: Setting parameters
Ex. Set Ex. Set Ex. Set
system
prompt, max_tokens
, and temperature
:temperature
, max_tokens
, and stop_sequences
:api_key
:Claude for Sheets usage examples
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!Troubleshooting
NAME? Error: Unknown function: 'claude'
NAME? Error: Unknown function: 'claude'
- Ensure that you have enabled the extension for use in the current sheet
- Go to Extensions > Add-ons > Manage add-ons
- Click on the triple dot menu at the top right corner of the Claude for Sheets extension and make sure “Use in this document” is checked
- Refresh the page
#ERROR!, ⚠ DEFERRED ⚠ or ⚠ THROTTLED ⚠
#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
Can't enter API key
- Wait 20 seconds, then check again
- Refresh the page and wait 20 seconds again
- Uninstall and reinstall the extension