The five functions

Syntax, examples and limits for AI, AI_CLASSIFY, AI_EXTRACT, AI_TRANSLATE and AI_SUMMARIZE.

All functions return text. text can be a cell or a range; with a range you get one answer per cell.

AI(prompt, [context])

Anything. The context (a cell or range) is appended to the prompt.

=AI("Write a friendly one-line product description for", A2)
=AI("Is this email a complaint? Answer yes or no.", B2)
=AI("Give three bullet points summarising these reviews", B2:B20)

AI_CLASSIFY(text, categories)

Returns exactly one of the comma-separated categories.

=AI_CLASSIFY(B2, "Bug, Billing, Feature request, Praise")
=AI_CLASSIFY(B2:B6, "Positive, Neutral, Negative")

AI_EXTRACT(text, what)

Pulls one value out of free text; empty if it isn’t there.

=AI_EXTRACT(B2, "the phone number")
=AI_EXTRACT(B2, "the delivery date as YYYY-MM-DD")

AI_TRANSLATE(text, language)

=AI_TRANSLATE(B2, "Hindi")
=AI_TRANSLATE(B2:B50, "Spanish")

AI_SUMMARIZE(text, [words])

=AI_SUMMARIZE(B2, 20)

How results are cached

Each prompt’s answer is stored with the spreadsheet for six hours. Recalculating, reopening the sheet or copying the formula elsewhere with the same inputs returns the cached answer at no cost and without counting against the monthly limit. Change the input text or the prompt and a new call is made.

Limits