Skip to main content

All available functions in GPT for Sheets

Discover all available functions in GPT for Sheets, along with simple examples and an extensive list of paramaters. If you are looking for usage examples, click here.

Prerequisites
You have opened a Google spreadsheet and selected Extensions > GPT for Sheets and Docs > Enable GPT functions.
To enable GPT functions, you must be the Creator of the spreadsheet. Learn more.

GPT function

The simplest function to start using GPT in Google Sheets. Outputs the result in a single cell.
info

To process images, use GPT_VISION. To get up-to-date information based on recent web search data, use GPT_WEB.

How to use

Syntax=GPT(prompt, [value], [temperature], [model])
Copy/paste example
=GPT("Write a tagline for an ice cream shop.")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputA response to your prompt in a single cell

Parameters

ParameterDefinition
prompt (cannot be empty)Instruction provided to the AI to generate a result in a single cell.
The prompt parameter can be:
  • A string: "Write a tagline for an ice cream shop."
  • A cell: A1
  • A range of cells: A1:C3
(optional) valueText, cell or range you want your prompt to apply to

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_LIST / GPT_HLIST function

Like GPT, but outputs the results in a column. Very practical when the output is a list.

  • Use GPT_LIST to return options listed vertically.
  • Use GPT_HLIST to return options listed horizontally.

How to use

Syntax=GPT_LIST(prompt, [value], [temperature], [model])
Copy/paste example
=GPT_LIST("Give me 5 good short ads about spreadsheets.")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputAs many responses to your prompt as you asked, one response per cell

Parameters

ParameterDefinition
prompt (cannot be empty)Instruction provided to the AI to generate a list.
The prompt parameter can be:
  • A string: "Give me 5 good short ads about spreadsheets."
  • A cell: A1
  • A range of cells: A1:C3
(optional) valueText, cell or range you want your prompt to apply to

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_SPLIT / GPT_HSPLIT function

Splits text semantically, such as by section, paragraph, sentence, customer…

  • Use GPT_SPLIT to return outputs listed vertically.
  • Use GPT_HSPLIT to return outputs listed horizontally.

How to use

Syntax=GPT_SPLIT(text, split_by, [temperature], [model])
Copy/paste example
=GPT_SPLIT("Hello! How are you? Have you heard of GPT for Work?", "sentences")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputInput text is split as requested, one element per cell

Parameters

ParameterDefinition
text (cannot be empty)Input text to split.
The text parameter can be:
  • A string: "Hello! How are you? Have you heard of GPT for Work?"
  • A cell: A1
  • A range of cells: A1:C3
split_by (cannot be empty)How to split the text. Examples:
  • sections
  • paragraphs
  • sentences
  • punctuation

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_FILL function

Magically fills or cleans a range from a few examples. For best results, use GPT_FILL with the gpt-4o model and add custom instructions to guide the AI.

info
If you have access to the gpt-3.5-turbo-instruct model with your own API key, use it with GPT_FILL. This model is task-oriented and can be more accurate than the gpt-4o model, which is a chat model and requires instructions in natural language to provide similar results.

How to use

Syntax=GPT_FILL(examples, [inputs], [temperature], [model])
Copy/paste example
=GPT_FILL(S4:U5,S6:S14)
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe empty part of the range will be filled based on the examples provided

Parameters

ParameterDefinition
examplesRange containing complete examples that the AI should learn from
(optional) inputsRange containing incomplete data that the AI should complete from the examples

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_TABLE function

Like GPT, but outputs the results in a table. Very practical when the output is a table.

How to use

Syntax=GPT_TABLE(prompt, [head], [inputs], [temperature], [model])
Copy/paste example
=GPT_TABLE("top 10 most eaten fruits and their nutrition data")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe response to your prompt in the shape of a table

Parameters

ParameterDefinition
prompt (cannot be empty)Instruction to generate a table.
The prompt parameter can be:
  • A string: "top 10 most eaten fruits and their nutrition data"
  • A cell: A1
  • A range of cells: A1:C3
(optional) headRange containing at least one row. the first row should be headers, the following rows can be used to specify examples If left empty, headers will be generated automatically.
(optional) inputsRange containing partial rows to complete with GPT_TABLE

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_MATCH function

Matches the values of two columns by similarity.

info

Regardless of the model you choose, this function always uses text-embedding-ada-002. If you have access to text-embedding-ada-002 with your own API key, select it in the model switcher to reduce costs. Learn more about pricing.

warning
GPT for Sheets settings do not apply to the GPT_MATCH function.

How to use

Syntax=GPT_MATCH(search_keys, lookup_range, [confidence], [stats], [top_k])
Copy/paste example
=GPT_MATCH(A1:A10,B1:B4)
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputA column of the best matches to each value in the range

Parameters

ParameterDefinition
search_keys (cannot be empty)The values that you want to look for in the range
lookup_range (cannot be empty)The range in which to look for values that are similar to search keys
confidence (optional)Set a similarity threshold: only values with a superior similarity score are matched. Must be comprised between 0 and 1
stats (optional)"true" to display similarity scores
top_k (optional)Number of matching values to return per search_key (default: 1 - only the best match)

See more usage examples.

info

GPT_MAP and GPT_MATCH perform the same task. We removed GPT_MAP from the list of available functions, but it still executes if manually typed.

GPT_FORMAT function

Formats dates, currencies, addresses, names, etc. Fixes capitalization. And so much more.

info

GPT_CONVERT and GPT_FORMAT perform the same task. We removed GPT_CONVERT from the list of available functions, but it still executes if manually typed.

How to use

Syntax=GPT_FORMAT(input, target_format, [source_format], [temperature], [model])
Copy/paste example
=GPT_FORMAT("14 February 71", "iso")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe converted input in a single cell unless it is converted a table, which outputs a table

Parameters

ParameterDefinition
input (cannot be empty)Input text to format.
The input parameter can be:
  • A string: "14 February 1971"
  • A cell: A1
  • A range of cells: A1:C3
target_format (cannot be empty)Target format for the input. Examples: "iso", "currency iso", "international phone number", "lowercase/uppercase/camelcase/snake case/title case/sentence case"…
(optional) source_formatSource format of the input. Optional, but including it can yield better results.

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_EDIT function

Applies the given task to the given text. The default task is to fix grammar and spelling.

How to use

Syntax=GPT_EDIT(text, [task], [temperature], [model])
Copy/paste example
=GPT_EDIT("For sum reezon thoose nunsberz arnt addin up")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe edited text in a single cell

Parameters

ParameterDefinition
text (cannot be empty)Input text to edit.
The text parameter can be:
  • A string: "For sum reezon thoose nunsberz arnt addin up"
  • A cell: A1
  • A range of cells: A1:C3
(optional) taskText, cell or range specifying how the text should be edited. Defaults to fixing grammar and spelling. Other examples:
  • "Make it funnier"
  • "Make it shorter"
  • "Make it sound formal"
  • "Add an ending"

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_TAG function

Applies user-defined tags to text or automatically suggests relevant tags if none are specified.

How to use

SyntaxGPT_TAG(value, [tags], [examples], [top_k], [temperature], [model])
Copy/paste example
=GPT_TAG("I love chocolate", "food, positive, negative")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe applicable tags as csv in a single cell

Parameters

ParameterDefinition
value (cannot be empty)Input text to tag.
The value parameter can be:
  • A string: "I love chocolate"
  • A cell: A1
  • A range of cells: A1:C3
(optional) tagsComma-separated tags or range of tags applicable. If left empty, GPT_TAG will automatically come up with the tags
(optional) top_kMaximum number of tags to return
(optional) examplesA table of examples in two columns. The first column should contain the inputs and the second column should contain the outputs.

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_CLASSIFY function

Classifies a given text into a single category.

How to use

Syntax=GPT_CLASSIFY(value, categories, [examples], [temperature], [model])
Copy/paste example
=GPT_CLASSIFY("banana", "fruit, vegetable")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe best applicable category

Parameters

ParameterDefinition
value (cannot be empty)Input text to classify.
The value parameter can be:
  • A string: "banana"
  • A cell: A1
  • A range of cells: A1:C3
categories (cannot be empty)Comma-separated categories or range of categories to choose from. Only the most relevant category will be returned.
(optional) examplesA table of examples in two columns. The first column should contain the inputs and the second column should contain the outputs.

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_EXTRACT function

Extracts data (like email addresses or company names) from a text. Outputs as comma-separated values.

How to use

Syntax=GPT_EXTRACT(text, to_extract, [temperature], [model])
Copy/paste example
=GPT_EXTRACT("I worked 5 years at Amazon.com and then 3 years at Apple", "companies")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe extracted entities as comma-separated values in a single cell

Parameters

ParameterDefinition
text (cannot be empty)Input text to extract data from.
The text parameter can be:
  • A string: "I worked 5 years at Amazon.com and then 3 years at Apple"
  • A cell: A1
  • A range of cells: A1:C3
to_extract (cannot be empty)Text, cell or horizontal range specifying what you want to extract. Examples:
  • "companies"
  • B3:E3

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_SUMMARIZE function

Summarizes text according to a given format (three sentences by default).

How to use

Syntax=GPT_SUMMARIZE(text, [format], [temperature], [model])
Copy/paste example
=GPT_SUMMARIZE("some long content here")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputA summary in the requested format in a single cell

Parameters

ParameterDefinition
text (cannot be empty)Input text to summarize.
The text parameter can be:
  • A string: "Some long content"
  • A cell: A1
  • A range of cells: A1:C3
(optional) formatFormat of the summary. Examples:
  • "key takeaways"
  • "action items"
  • "two paragraphs"
  • "100 words"
  • "tweets"

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_TRANSLATE function

Translates text from one language into another. Works better if you specify the source language.

How to use

Syntax=GPT_TRANSLATE(text, [target_language], [source_language], [instructions],[temperature], [model])
Copy/paste example
=GPT_TRANSLATE("Cool off with our delicious treats!", "spanish")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputThe requested translation in a single cell

Parameters

ParameterDefinition
text (cannot be empty)Input text to translate.
The text parameter can be:
  • A string: "Cool off with our delicious treats!"
  • A cell: A1
  • A range of cells: A1:C3
(optional) target_languageLanguage of the output. Examples: "spanish", "chinese", "french". Defaults to "english".
(optional) source_languageLanguage of the input. Example: "english"
(optional) instructionsAdditional instructions for the translation. Can include a dictionary of translations.

(optional) temperature, model

temperature is a number between 0 and 1. Use it to control creativity.
Go to temperature and model to learn more.

See more usage examples.

GPT_CREATE_PROMPT helper function

Like CONCATENATE, but inserts spaces and newlines automatically. Helps you create a prompt from scattered, disjointed cells and ranges. You can then use that prompt in GPT functions. This function doesn’t call any model provider's API and thus doesn’t incur any cost.

How to use

Syntax=GPT_CREATE_PROMPT(arg1, [arg2], [arg3], [...argn])
Copy/paste example
=GPT_CREATE_PROMPT(A1:B1, A2, C3:D5, E1:E6)
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputA prompt ready to use in GPT, GPT_LIST or GPT_TABLE

Parameters

ParameterDefinition
arg1 (cannot be empty)Cell or range to concatenate
  • A1
  • A1:C3
(optional) arg2 - argnCell or range to concatenate
  • A2
  • G2:H4

GPT_VISION function

Applies a prompt to an image. For example you can ask a question about the image, ask for a description of it, or generate alt text for images. Learn more.

info
  • Regardless of the model you choose, this function always uses gpt-4o. If you have access to gpt-4o with your own API key, select it in the model switcher to reduce costs. Learn more about pricing.
  • GPT_VISION is the only function that accepts images as input.

How to use

Syntax=GPT_VISION(prompt, image_url, [high_res], [temperature])
Copy/paste example
=GPT_VISION("Write a short description for this product", A1)
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputA response to your prompt according to the information extracted from the image

Parameters

ParameterDefinition
prompt (cannot be empty)Instruction provided to the AI to analyze an image.
The prompt parameter can be:
  • A string: "Write a short description for this product"
  • A cell: A1
  • A range of cells: A1:C3
image_urlLink to the image you want the AI to analyze. Supported formats are PNG, JPEG, WebP, and non-animated GIF. Maximum size is 20MB per image.
The image_url parameter can be:
  • A string: "https://static.nike.com/a/images/t_PDP_1280_v1/f_auto,q_auto:eco/b5ab0a6c-6393-4af6-abbc-4f1acaa6ed94/air-max-dawn-womens-shoes-224mWf.png"
  • A cell: A4
(optional) high_resHow the AI processes the image and generates its textual understanding. Possible values are true, false, and auto (default). Learn more.

(optional) temperature

Number between 0 and 1 that governs the creativity of GPT:

  • 0 makes GPT strictly follow the prompt
  • 0.5 makes GPT slightly creative
  • 1 makes GPT very creative
Note: In some locales, you might need to use "0,5" instead of "0.5"

GPT_WEB function

Provides up-to-date information sourced from recent web search data. Use GPT_WEB when you need fresh and accurate answers to questions about companies, current events, facts, people, and more. The function is built on the Perplexity API.

info
  • Regardless of the model you select, GPT_WEB always uses the Perplexity API model llama-3.1-sonar-small-128k-online.
  • GPT_WEB is the only function that generates responses based on recent web search data.

If you provide a URL in the prompt, the function attempts to generate a response based on search data from that specific web page.

Searching a specific page only works if:

  • Perplexity's web crawler has already independently indexed the content of the page. The crawler does not index new pages on demand based on URLs you provide. In addition, the crawler respects robots.txt directives and does not index disallowed content.
  • The URL points directly to the page without any redirects. To check if a URL results in redirects, use the Redirect Checker.

If a specific URL does not produce valid results, use web scraping to retrieve the information from the page.

Warning
  • GPT_WEB is priced per 1000 executions instead of tokens. In this case, input and output size do not matter. The price of GPT_WEB is $15 or €15 per 1000 executions.
  • It is recommended to use Safe mode with GPT_WEB to avoid most timeouts, prevent data loss and avoid extra costs during automatic Sheets refreshes.
  • GPT for Sheets settings do not apply to the GPT_WEB function.

How to use

Syntax=GPT_WEB(prompt, [value])
Copy/paste example
=GPT_WEB("Who won the last presidential elections in Argentina?")
⚠️ LocalizationIn some locales, you might need to use ";" to separate parameters instead of ","
OutputA response to your prompt based on recent web search data

Parameters

ParameterDefinition
prompt (cannot be empty)Instructions provided to the AI to generate results based on recent web search data. Provide instructions in English for better results.
The prompt parameter can be:
  • A string: "Who won the last presidential elections in Argentina?"
  • A cell: A1
(optional) valueText, cell, or range you want your prompt to apply to


temperature and model

These parameters are present in most GPT functions. They are always optional.

For example with the GPT function, you can set:

  • The temperature to 0.1

  • The model to "gpt-3.5-turbo-0301"

    the 2 parameters come last in the formula

You can also set these values from the sidebar very easily. In this case, they become the default values for all future executions.

ParameterDefinition
(optional) temperatureNumber between 0 and 1 that governs the creativity of the model:
  • 0 - strictly follow the prompt
  • 0.5 - slightly creative
  • 1 - very creative
Note: In some locales, you might need to use "0,5" instead of "0.5"
(optional) modelTechnical name of the model surrounded by quotes. The technical names are listed in the Model menu of the Settings section of the sidebar. Learn more about models.