UPDATE 2025: While Google have now added the =AI function, this below sill has some validity as a basis to intergrate the Responsis API into Google Sheets. Which would allow you do control the prompts and outputs for your teams.

How to get your copy of ChatGPT in Google Sheets

Or use the link below:

https://docs.google.com/spreadsheets/d/1bUvttcmE8F2-T7Vcv0lc_7fKuqbaC5Zgcu1RAJ3gObQ/edit

And make a copy as shown in the video. 

NOTE: We have chosen to share the template in this way because it will give you access to our script; you are free to modify and reuse this for your own projects.

How to Get your OpenAI API Key

Show and tell how to use ChatGPT in Sheets



Occasionally, you may need to reload or refresh the sheet after setting your API key.

You will have access to three GPT models, as shown below.

=gpt3("hello") =gpt4("hello") =gpt4o("hello") 

Use the functions as you would any other Google Sheet function. For Example:

=gpt4o(A3)

The GPT will return its result based on the information passed on to it. In the example above, the contents of cell A3 are sent to the model for evaluation.

If you want to send information from different cells for it to evaluate, as shown in the explainer video, use the '&' operator to "join" or concatenate the values of these cells. For example:

=gpt4o(A3 & B4 & C3)

The expression above will make the GPT evaluate the text generated by combining the values in cells A3, B4 and C3 using the GPT-4o Model.

We suggest putting your prompt value first and recommend making this an absolute reference. For example, if your prompt is in cell A3, replace A3 with '$A$3', i.e.

=gpt4o($A$3 & B4 & C3)

This will ensure that when you 'drag' the formula to apply to many rows or columns, it applies only once the cell contains the prompt.

If you want to read more about the models or want to add other models to the script, you can get that information here

https://platform.openai.com/docs/models

Some additional tips:

Error Handling: If the GPT function returns an error, check your API key and ensure the cells you are referencing are not empty or contain the expected data.

Character Limits: Be mindful of character limits in Google Sheets formulas and the API's maximum input length.

The input levels for GPT models used here are:

  • GPT-3: Maximum input length is 2048 tokens.
  • GPT-4: Maximum input length can be either 4096 or 8192 tokens, depending on the specific variant.

A token can be a character or word; 100 tokens are roughly 75 words - In essence, you should not have a problem.

Rate Limits: Be aware of API rate limits. If you make many calls (think of each row where you use the GPT function as a call), you might need to introduce delays or batch your requests. We have used it for over 5,000 rows and have not hit a limit yet. If you do, break things up into multiple sheets.