ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1
2
Claude for Sheets™: template workbook
3
4
This spreadsheet contains example workbook structures for Claude for Sheets™, mainly set up for prompt engineering but easily adaptable to other use cases.
Please review Anthropic's Documentation and Acceptable Use Policy.

To set up for editing:
1. Make a copy of this sheet and save it to your Google Drive

2. If you have NEVER used Claude for Sheets, do the following (otherwise skip to step 3):
a. Install this Claude for Sheets add-on
b. Click the "Claude for Sheets" menu under “Extensions” at the top of your spreadsheet, and "Enter your Anthropic API key"
You will not be able to use the Claude for Sheets without an Anthropic Developer API key

3. Enable the use of Claude for Sheets inside this workbook:
a. Go to Extensions > Add-ons > Manage add-ons
b. Click on the triple dots on the top right corner of the Claude for Sheets extension and make sure "Use in this document" is checked
5
6
Claude for Sheets simple explanation:
7
Cell B11 houses an example of the CLAUDE function, which calls the Claude API. Try typing different questions into the Prompt cell. The answer wil appear in the response cell a few seconds later.
8
Prompt:
9
When was the US constitution written?
10
CLAUDE response (generated with an API call to Anthropic!)
11
#ERROR!
12
13
How to use Claude:

★ =CLAUDE() - this function will automatically wrap your prompt in the proper formatting of "\n\nHuman: ${your_prompt}\n\nAssistant:" for you. To use this function, all you need is a plaintext prompt with no additional formatting. This is the function you'll probably want to use most of the time. This is identical to the Slackbot Claude interface and "Chat" mode on the console.

★ =CLAUDEFREE(prompt, model, params...) - to use this function, you will have to sandwich your prompt between "\n\nHuman:" and "\n\nAssistant:". Replace "\n\n" with two actual new lines when writing your prompt in a cell. This is identical to the raw API Claude interface and "Edit Chat" mode on the console. For more information on the special "Human:"/"Assistant:" formatting in CLAUDEFREE, see our documentation on prompt design.

To make new lines in a cell, do the following:
Mac: Cmd + Enter
Windows: Alt + Enter

Each function has parameters that will be explained in a tooltip as you start typing it in a cell.

Adding parameters:
If you want to specify API parameters, you can do so by listing "parameter name" (in quotation marks), "parameter value" at the end of the call. For example, if you want to set the max_tokens to 3, you can do it as follows: =CLAUDE("[your prompt]", "claude--instant-1.2", "max_tokens_to_sample", 3).

You can set multiple parameters. Simply list them one after another, each with a name and value pair separated by commas.
For example, this is valid CLAUDE function: =CLAUDE("[your prompt]", "claude-instant-1.2", "max_tokens_to_sample", 3, "temperature", 0.5)

The parameters you might care about most are:
"max_tokens_to_sample" - the total number of tokens the model outputs before it is forced to stop. For yes/no or multiple choice answers, you probably want 1-2. Otherwise you'll want as many as 200 if you want a long answer.
"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.
14
15
16
17
18
Versions of Claude available:
19
claude-instant-1.2
20
claude-2
21
claude-2.1
22
claude-3-haiku-20240307
23
claude-3-sonnet-20240229
24
claude-3-opus-20240229
25
26
Getting your prompt to work:
27
1. Read our API Documentation first.
28
2. If your prompt isn't working as desired, use the prompting checklist to make sure you're doing everything right.
29
3. To learn prompting best practices, visit our interactive prompt engineering tutorial (requires API key) - or the tutorial answer key, which doesn't require an API key.
30
31
Disclaimer: Sharing

Note that if you share a Claude for Sheets spreadsheet with other users in your Google Workspace organization, they will be able to use the custom functions without having to install the add-on. The API key will be available as well to the add-on (so that the custom functions can make the Anthropic API calls), but the users won't be able to see it. The Claude for Sheets menu will be visible, but trying to use its functions will prompt the user to install the add-on first.
If the Claude for Sheets spreadsheet is shared with users outside the organization, they will be able to use the custom functions (with the API key that was entered before sharing the document) as well, but won't see the Claude for Sheets menu until they install the add-on.

Disclaimer: Pricing

The Claude for Sheets add-on is free. However, the add-on relies on your Anthropic API key and any API calls made from the add-on will be billed at your normal pricing schedule with Anthropic via your account associated with the API key. Please be careful with sharing this add-on, your Anthropic API key or any associated Google Sheets with the Claude for Sheets add-on. Please confirm that any recipient of your Google Sheets with the Claude for Sheets add-on understands the billing will incur on your Anthropic API account (see SHARING section above).

Disclaimer: Other Considerations

⚠ Please exercise caution as you interact with Claude and double-check the output.
⚠ Claude may occasionally generate incorrect or misleading information, or produce offensive or biased content.
⚠ Claude is not intended to give professional advice, including legal, financial, and medical advice. Do not rely on Claude without doing your own independent research.
⚠ Please don’t share sensitive or personal information in your conversations with Claude.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100