AI
The AI function, also available as Gemini, uses Google Workspace with Gemini to generate text, summarize or categorize spreadsheet data, analyze sentiment, and retrieve current information. It is commonly used to turn prompts and optional cell ranges into text output directly inside Google Sheets.
Usage
Use the AI formula with the syntax shown below, it has 1 required parameter and 1 optional parameter:
=AI(prompt, [optional range])- prompt (required):
A text prompt describing the task that Gemini should perform. - optional range (optional):
An optional cell or range that provides spreadsheet context for the prompt.
Examples
Here are a few example use cases that explain how to use theAI formula in Google Sheets.
Generate text from row data
Use AI to draft short descriptions, messages, summaries, or other text based on values in nearby cells.
Summarize spreadsheet content
Point the prompt at a cell or range so Gemini can produce a concise summary of feedback, notes, or other text-heavy data.
Categorize records
Use AI to classify rows into categories such as sentiment, topic, status, or priority based on spreadsheet values.
Fetch current information
Use the function for prompts that need up-to-date information from Google Search when the feature is available for the account.
Common Mistakes
AI not working? Here are some common mistakes people make when using the AI Google Sheets Formula:
Using an ineligible account
The function requires an eligible Google Workspace or Google AI plan and can also depend on admin and language settings.
Expecting spreadsheet-wide context
The function does not automatically use the entire spreadsheet. Provide relevant cells or ranges as context when the prompt depends on sheet data.
Embedding AI inside another formula
Embedded AI functions are not supported. Use the function as its own formula and reference the generated result separately if needed.
Expecting undo and redo behavior
Generated output is inserted through the AI workflow, so refresh or regenerate the output instead of relying on normal formula undo behavior.
Ignoring generation limits
The function has generation limits, including limits on selected cells and longer-term usage. Wait and retry if limits are reached.
Related Formulas
The following functions are similar to AI or are often used with it in a formula:
-
TEXTJOINThe
TEXTJOINformula concatenates (joins together) multiple text strings using a delimiter of your choice. This can be useful when combining lists, creating sentences, or formatting data for export. You can choose to ignore empty cells or include them as part of the output. -
CONCATENATEThe CONCATENATE function in Google Sheets is used to combine text strings from different cells or inputted directly in the formula. It takes one or more text strings as input and returns a single concatenated string. This function is commonly used to combine first and last names, or to merge data from multiple cells into a single cell.
-
IFThe
IFformula is a logical function used to test a condition and return one value if the condition is true and another value if the condition is false. It is commonly used to create conditional statements and perform calculations based on certain conditions. -
IFSThe
IFSformula evaluates multiple conditions and returns a corresponding value for the first condition that is true. It is commonly used as a more concise alternative to nestedIFstatements. -
REGEXMATCHThe
REGEXMATCHformula searches for a regular expression pattern within a specified text string, and returns a boolean value of TRUE if the pattern is found, and FALSE if it is not found. This formula is commonly used to check if a string matches a certain pattern or to extract specific information from a text string based on a pattern.
Learn More
You can learn more about the AI Google Sheets function on Google Support.