How to use OpenAI's GPT-3 to create lists

Learn how to use Open AI and GPT-3 inside the spreadsheet to create lists of data.

About OpenAI and GPT-3

OpenAI developed GPT-3, 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 web pages, books, and more.

GPT-3 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 can 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. Follow this guide on how to set up the integration and use this template showcase to get started with 10 pre-built examples, follow along the list, or watch our video tutorial.

Using the ASK_OPENAI function

The OpenAI integration 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

The function has 4 parameters: 1 mandatory and 3 optional, with the following signature: ASK_OPENAI(prompt,[temperature], [max_tokens],[model]). 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 =ASK_OPENAI(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

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

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.

How to use ASK_OPENAI to create lists of data

Tips for creating lists of data

Use 'Json table' in the prompt

Include in the prompt that the goal is to create a "Json table". JSON is the standard file format accepted by Rows to create lists of data.

The prompt will result in a data cell labeled openai. Click on the ▼ icon and select Create Data Table to expand its result in the spreadsheet. Use the wizard on the right side of the spreadsheet to select which columns to add to the table.

US Presidents

Use the max_tokens parameter

Set a large number in the max_tokens argument to ensure that the OpenAI response is not inadvertently capped to the default max_token value (200).

If that happens, the ASK_OPENAI formula response will be an incomplete JSON file, like the one below. This is an indication that the max_tokens parameter might be too low.

Incomplete JSON

Be clear on the columns' names

Be specific on which columns you expect to be part of the list. If you want a list of the names of the last 5 US Presidents, include exactly what you want to see.

1=ASK_OPENAI("Create a json list with the names and birth dates of the last 5 US Presidents",,500)

US Presidents

Be clear on the columns formats

The same applies to the formats of the data. If you want the output to be formatted in a specific way - e.g. dates as YYYY-MM-DD be explicit on the prompt.

1=ASK_OPENAI("Create a json list with the names and birth dates (YYYY-MM-DD) of the last 5 US Presidents",,500)

US Presidents YYYY-MM-DD


Create a table with dummy names and email addresses


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


1=ASK_OPENAI("Create a json list with 10 first names, last names and email addressess",,500)

Dummy email addresses

💡 Add variations to the prompt to get different responses of the same structure. If you want to generate a list of email addresses but add diversity to them (e.g mix English with non-English names), be specific on the prompt:

1=ASK_OPENAI("Create a JSON list with 10 first names, last names and email addresses. It should contain a mix of nationalities",,500)

Emails mix