All posts
Published at Tue Feb 07 2023 in
For Teams

How to connect GPT-3 to Google Sheets and Rows

How to Connect GPT-3 to Google Sheets and Rows

OpenAI's GPT-3 is an advanced artificial intelligence model that, among other things, offers comprehensive text completion capabilities. Due to its ability to process large amounts of data, it can be used to automate many text-based tasks - classification, summarization or even generating datasets.

This article will walk you through three ways to integrate GPT-3 into your Rows or Google Sheets workflow, so that you can take full advantage of GPT-3 inside a spreadsheet.


To integrate GPT-3 with any of the tools to be discussed further in this article, you’ll need the following:

  1. OpenAI account: If you don’t already have an account, sign up here.

  2. API keys: After creating an account, create API keys. Do this on your profile’s API keys page by clicking the Create new secret key button and copy the generated keys.

API Key panel in Open AIThe API Key panel on the OpenAI dashboard

1. Rows

Rows is a web application for creating modern, beautiful and rich spreadsheets. It combines a spreadsheet editor, data integrations (eg. Social media, Google Analytics, Salesforce, Stripe) and a novel sharing experience that turns any spreadsheet into a website in one-click. 

In three simple steps, you can connect OpenAI with Rows:

  1. Go to the OpenAI integration page.

  2. Click the Connect button to reveal a popup that requests for an API key.

  3. Paste your OpenAI API keys and connect.

The beauty of this Rows-OpenAI connection is the seamless setup. It is the only solution that doesn’t require any add-ons, scripts or manual work to get it running. 


Simply use the formula =ASK_OPENAI via the autocomplete in the editor, or via the Actions wizard and give it the prompt or task that you want to solve.

ASK_OPENAI screenshot

The function has 4 parameters: 1 mandatory and 3 optional, with the following signature: ASK_OPENAI(prompt,[temperature], [max_tokens],[model]) prompt:

  • Prompt: The instruction to give to the model. This is where you'll enter the "ask" you want the AI to answer. You can use the prompt to solve a task by explicitly writing it in prose or you can use spreadsheet functions to concatenate values in different cells to construct the prompt.

  • Temperature: The sampling temperature to use, varying between 0 and 1. Use 1 for creative applications, and 0 for well-defined answers.

  • Max tokens: The maximum number of tokens to generate in the completion. You can think of tokens as pieces of words. 1 token is about 4 chars in the English language.

  • Model: The AI model to use to generate the answer. By default, it uses "text-davinci-003". See here a list of all of the available GPT-3 models.

For a deep dive on how to use OpenAI in Rows, read this tutorial or watch the video.

2. Google Sheets

Google Sheets is one of Google’s suite of online web-based applications. It is used to create, edit and collaborate on spreadsheets. Integrating OpenAI’s GPT-3 will enhance its abilities at data analysis, task automation, generating insights and generally making it smart.

Here are two ways to use GPT-3 inside Google Sheets:


The Sheet AI app is a Google Sheets add-on that unlocks the potential of data by providing powerful AI capabilities to anyone who needs it by making it accessible through the familiar Google Sheets interface. 

Here’s how to integrate it with Google Sheets:

1.  Install it on your Google Workspace 

2. On Google Sheets, go to Extensions and click to launch the SheetAI App.

Launching the Sheet AI add-on

3. From the sidebar, connect OpenAI to SheetAI App by providing your OpenAI API keys and clicking Save.


This add-on comes with 3 new formulas you can use in Google Sheets:

  • SHEETAI(prompt, max_words, creativity, model)

  • SHEETAI(examples_input, examples_output, input, custom_prompt, creativity, model, maxTokens)

  • SHEETAI_IMAGE(imgdesc, heightWidth, creativity)

Spreadsheet Magic

This is another Google Sheets add-on that leverages on the artificial intelligence of OpenAI’s GPT-3 to fill out a table, given only row and column headings and no other input from a user. Unlike the previously discussed tools, this takes a manual setup.

Spreadsheet Magic App ScriptThe App Script interface with the spreadsheet magic code
  1. Visit the Spreadsheet Magic repository on GitHub and copy all the content within Code.js

  2. In Google Sheets, go to Extensions and then Apps Script

  3. In the new Apps Script, paste the copied Code.js content and replace [API_KEY_GOES_HERE] with your OpenAI API keys.

  4. Click on the floppy disk icon on the top bar to save the script.

  5. Go back to the Google Sheet spreadsheet, refresh the page and wait a couple of seconds. On the top bar, to the right of "Help", you should see a new "GPT-3" option.

  6. To activate, click the GPT3 menu item and select Fill with GPT-3. You'll need to authorize the connection.

  7. You'll see an alert from Google telling you that the app has not been authorized. You can click to show Advanced and Go to [project name] (unsafe).

  8. To use the GPT-3 add-on, first create a table with the header names and the first column of data filled. To populate the rest of the columns using AI, select the range of cells of the table and click GPT-3 > Fill with GPT-3.

Spreadsheet magic add-onUsing the GPT-3 add-on in Google Sheets


Integrating OpenAI's GPT-3 with spreadsheets will be a game changer for data analysis and a must-have for business professionals. By capitalizing on the power of advanced language processing, you can streamline your analysis process, gain deeper insights, and confidently make informed decisions.

Rows is the simplest way to add the power of GPT-3 to a spreadsheet. Sign up for Rows and discover why thousands of teams use it to upgrade their spreadsheet game.