Using OpenAI in Rows

Learn how to use Open AI and GPT-3 inside the spreadsheet to generate answers to questions or for tasks like summarization, classification, or translation.

About OpenAI and GPT

OpenAI developed GPT, a type of artificial intelligence model that is capable of generating human-like text. It uses a machine learning technique called pre-training to learn the statistical patterns of a large dataset and then fine-tunes its knowledge on a smaller dataset to perform a specific task. It is trained on a dataset with billions of elements, including a significant part of the internet webpages, books and more.

GPT can be used for a variety of language-based tasks, such as language translation, summarization, question answering, and text generation. It can generate coherent and coherently structured paragraphs, articles, and even entire books, given a prompt or topic. GPT has the ability to learn and adapt to new tasks quickly, making it a powerful tool for natural language processing.

NOTE: There are known limitations to these models and the output is not guaranteed to be factually accurate.

How to use OpenAI in Rows

OpenAI template

There's a near-infinite amount of tasks you can solve using OpenAI. Use this template showcase to get started with 10 pre-built examples, follow along the list, or watch our video tutorial.

Connecting the OpenAI integration in Rows

You can find the Open AI integration by browsing the integrations gallery and searching for "Open AI".

Open AI integration in gallery

To connect the integration and use the power of AI inside Rows all you need is an API Key. You can get your API key by going to the View API Keys option on your OpenAI account. If you don't have an account yet, sign-up here. All free accounts have API access.

API Key panel in Open AI

Now simply copy the API key, go to the Open AI integration page, press Connect, paste it and click Connect. Your Rows workspace is now connected to your OpenAI account and you're ready to go.

Open AI integration page

Using the ASK_OPENAI function

The OpenAI integrates contains one function - ASK_OPENAI - that you can use to perform hundreds of tasks

You can use the ASK_OPENAI function via the Autocomplete in the editor, or via the Actions wizard.

ASK_OPENAI on the editor

OpenAI wizard in the Actions panel

The function has 4 parameters: 1 mandatory and 3 optional, with the following signature: ASK_OPENAI(prompt,[temperature], [max_tokens],[model]) prompt. Let's go one by one.


The prompt is 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. Examples:

  • Use =ASK_OPENAI("Population of France is, in millions, :") if you are not using any cell references inside the prompt.
  • Use =ASKOPENAI(CONCATENATE("The population of ",_A2," in millions, is: ")) if you're using A2 as an input (the country name) to the prompt.

Prompt creation with Concatenate

Tips for creating Prompts

The Open AI integration uses its Completions capability, which means that the artificial intelligence model will predict the next word(s) that follow the prompt. With that in mind, here are a few tips on how to construct the right prompt for your task:

  • Be specific: The more specific the prompt, the most likely it is to get the intended result. If you're looking for the Population of the country in millions, "The Population of France, in millions is: " is a better prompt than simply "The Population of France".
  • Give examples: You can train the model on the type of answer you're looking for. If you are using Open AI for text classification, use the prompt to give a couple of examples of inputs and expected outputs. For example: "Categorize job title by function name. Head of Marketing:Marketing, COO:C-Level, CMO: "
  • Phrase the end of the prompt as the start of the answer: The model will answer with a direct continuation to the prompt. Use that insight to end the prompt with the structure you expect from the answer. If you want to use the OpenAI integration to summarize text, be clear on how to start. Example: "What are 2 main takeaways from this review: ",A2(cell reference with the product review)," ? Summarize it into 2 bullet points. Main takeaways: ")

Temperature (optional)

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

If you're doing tasks that require a factual answer (e.g. country populations, capitalize text), then 0 (the default) is a better fit. If you're using the AI for tasks where there aren't definite answers - such as generating text, summarizing text, or translating - then experiment with a higher temperature

Max_tokens (optional)

This max_tokens represents the maximum number of tokens to generate in the completion. You can think of tokens as pieces of words. Here are a few helpful rules of thumb examples from the Open AI Help center:

  • 1 token ~= 4 chars in English
  • 1 token ~= 3/4 words
  • 100 tokens ~= 75 words
  • 1-2 sentences ~= 30 tokens
  • 1 paragraph ~= 100 tokens
  • 1,500 words ~= 2048 tokens

You can use any number starting with 0. The default value is 200. Most models have a context length of 2048 tokens, except for the newest models which support a maximum of 4096. For tasks that require more text output - text generation/summarization/translation - pick a higher value (e.g. 250).

Model (optional)

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

Examples of ASK_OPENAI in action

There's many things you can do with ASK_OPENAI in Rows:

  • Clean Up Data: Capitalize text, remove unnecessary text, parse email domains, and more.
  • Text Classification: Tag emails, classify emails or classify roles from LinkedIn profiles.
  • Sentiment Analysis: This is a subset of Text Classification to identify and extract subjective information from text. It can be used to determine the overall sentiment of a piece of text, as well as to identify specific opinions and emotions within the text.
  • Translation: Translation into other languages.
  • Summarization: Condense news articles, messages, legal documents, research papers, and more.
  • Create Tables with data: Create tables with dummy or public data.
  • Find and Enrich data: Generate dummy data or public data points for things you already have on your spreadsheet, like countries and companies.

Here's some practical examples.

Clean up Company names


Clean up a list of company names and remove legal abbreviations and filler text.


1=ASK_OPENAI(CONCATENATE("Remove legal entity abbreviations like GmbH, LLC, Inc., emojis, special characters and unnecessary text from ",A2,". Company name: "))


Assumes that A2 contains the company name.

Cleanup Companies GIF

Clean up Addresses


Extract Zip Code, State, and Country Code from an address.


1- Zip Code: =ASK_OPENAI(CONCATENATE("The Zip code of ",A2," is: "))
2- State: =ASK_OPENAI(CONCATENATE("The State of ",A2," is: "))
3- Country Code: `=ASK_OPENAI(CONCATENATE("The Country Code of ",A2," is: "))


All examples assume that A2 contains the company name.

Cleanup addresses GIF

Classify functions from a job title


Classify a Job Title according to its Function - e.g. C-Level, Marketing, Sales, etc.


1=ASK_OPENAI(CONCATENATE("Categorize job title by function name. Head of Marketing:Marketing, COO:C-Level, ",A2,":"))
  • Details:
    • Assumes that A2 contains the job title.
    • Adding the Head of Marketing and COO example in the prompt adds clarity to the prompt and increased the quality of the output.

Function classification GIF

Classify sentiment in social media comments


Analyze comments from social media accounts and extract the sentiment from the text.


1=ASK_OPENAI(CONCATENATE("Classify the sentiment of this post between 'Positive', 'Neutral' or 'Negative'. ,",A2," :"))
  • Details:
    • 💡 The use of the CONCATENATE function in the prompt creates the desired structure for the response:
    • Starts with the sentiment types to be classified. You can add others to your implementation.
    • It adds the social comment to be analyzed (A2).
    • It ends with : to prompt the AI to respond solely with the sentiment extracted from the text.

Sentiment analysis GIF

Translate product reviews from customers


Translate product reviews done by customers in third-party platforms - e.g. App Store, Trustpilot - to English.


1=ASK_OPENAI(CONCATENATE("Translate ",A2," to English: "),,200)


1- Assumes that A2 contains the product review text
2- 💡 Define a value for the `max_token` parameter - in this case, 200 - to allow enough tokens for the complete translation of the text.

Translation GIF

Summarize product reviews from customers


Summarize Product review comments into 2 bullet points with the key takeaways.


1=ASK_OPENAI(CONCATENATE("Summarize into 2 bullet points: ",A2),,300)


  • Assumes that A2 contains the product review text
  • 💡 Define a value for the max_token parameter - in this case, 300 - to allow enough tokens for the complete summarization of the text.


Create a table with dummy names and email addresses


Create a table with 5 names and email addresses to create a dataset to test a feature in QA.


1=ASK_OPENAI("Create a JSON table with 5 records of first name, last name and dummmy email addresses",,500)

This prompt will results in a data cell labeled Open AI. Click on the ▼ icon and select Create Data Table to expand its result in the spreadsheet.


  • 💡 Define a value for the max_token parameter - in this case, 500 - to allow enough tokens for the complete translation of the text.
  • ⚠️ Add the desired format of the table - JSON - to guarantee that it creates a table that can be extracted inside Rows.

Dummy data

Find the prices of Kindle books on Amazon


Get the price of the Kindle edition of a book on


=ASK_OPENAI(CONCATENATE("The price of the Kindle edition of ",A2," on is, in dollars: "))


Assumes that A2 contains the book title.

💡 Define a low value for the max_token parameter (in this case, 4) to guarantee that the answer is limited to the population number, and free from additional unnecessary context.

Kindle prices

Enrich a country with its emoji flag and population


Get the emoji of the flag and the number of inhabitants of a list of countries.


1- Flag: =ASK_OPENAI(CONCATENATE("The emoji flag of ",A2," is "))
2- Population: =ASK_OPENAI(CONCATENATE("The population of ",A2," in millions, is: "),,4)


Assumes that A2 contains the country name.

Country facts

Find the location of a company's HQ


Get the address of the headquarter of a list of companies.


1=ASK_OPENAI(CONCATENATE("The HQ address of ",A2," is :"))


Assumes that A2 contains the name of the company.

Company HQ