Experiment with LLMs in Google Sheets

Interact with Gemini in Google Sheets and chain sheets together to link multiple prompts

4 min read
Cover Image for Experiment with LLMs in Google Sheets


When I was at Google I wanted my product management team to get some hands on experience with LLMs so in our last offsite I setup a short LLM hackathon. Many of them had heard about LLMs but hadn't actually used them, or had briefly chatted with ChatGPT or Gemini but didn't really have a visceral sense for what they were capable of.

I gave them a set of prototyping tools to pick from including several internal Google tools and then one that I had made myself, which integrated Google's Gemini LLM directly into Google Sheets. My hypothesis was that Sheets would be the fastest way for most of them to get up and running given that they were already familiar with the UI. And that combining the power of Sheets with an LLM would unlock some interesting new possibilities.

It turned out that most teams did end up using the Sheets integration I had built. And they came up with some fun ideas :)

I rebuilt that integration and am sharing it here for anyone to use.

It's basically a baby version of Ask Steve. It enables you to create prompts with variables, change the variables, run the prompts without leaving Sheets, and even chain prompts together by referencing cells in other sheets.

It's a great way to get people who haven't played much with LLMs to dip a toe in the water with a familiar interface. It's also great for building sequential workflows with chained prompts. Give it a try, it's free!

Walkthrough Video


  1. Make your own copy of this Google Sheet.
  2. From the copy dialog you can review the attached script to ensure that it's not doing anything it shouldn't be. You can also review the code here
  3. In your new spreadsheet, enter your Google Gemini API Key on the SETUP sheet in cell A1. Get one for free!
  4. To test that it's working, go to the second sheet and then select Run from the Sheets LLM menu. It may take the menu a few moments to appear. The first time you select it, you will need to give the script access permissions to Sheets and to make external calls. You might see a scary looking dialog that says "Google hasn't verified this app". You will need to click on the Advanced link and then Go to Sheets LLM (unsafe).
  5. You will need to select the menu item a second time after giving permissions. The Result field should fill in with the results.
  6. Try your own prompts and adjusting the temperature between 0.0 and 1.0. You can put variables in your prompts by surrounding them with double-brackets like [[this]]. Then you can put the values for your variables in the cells below. See the examples in the sample sheets.
  7. You can chain LLM calls using multiple sheets. Note that the "2. Write a press release" sheet is taking the result from the "1. Generate product ideas" sheet and using it as a variable for a second prompt. And similarly, the "3. Suggest visuals" sheet is using the press release as an input. You will need to Run on each sheet to update it. Add as many new sheets as you like to this doc and run them independently or chain them together.
  8. Any live data that Sheets can import can be sent to Gemini. As an example the "Google News Feed" sheet reads the Google News rss feed and updates once an hour. Then the "Generate a movie plot from the news" sheet pulls the top news as variables and sends it to Gemini to create a movie plot.
  9. Feel like modifying the script that powers all this? Under the "Extensions" menu select "Apps Script" to access it. It is your own copy of the script that is attached to this specific doc, so feel free to make changes.
  10. This is using the publicly accessible Gemini API. Your input and output data can be used to improve Gemini. Do not send it any sensitive or confidential information.

Want to unlock the power of ChatGPT and Gemini in any web page? Install Ask Steve Now

Read more about

Cover Image for Connect to Any LLM
1 min read馃摪News

You can now connect to any cloud, internal or local LLM

Cover Image for Super Fast Responses with Groq Cloud
1 min read馃摪News

Try the Groq Cloud beta to get near instantaneous responses from Steve

Cover Image for How Steve Got His Name
1 min read馃摪News

Infinite Steves, at your service

Cover Image for Why We Built Ask Steve
2 min read馃摪News

For you. We built it for you. Read why here.