Use the AI function in Google Sheets

Feature availability

Important: Any user can insert the AI function into their sheet, but the generation feature is only available to users in Alpha program and Workspace Labs program.

You can use the AI function to:

  • Generate text.
  • Summarize information.
  • Categorize information.
  • Analyze sentiment.

To use the AI function, you can enter a specific prompt to describe your desired action and add an optional range: =AI(”prompt”, [optional range])

For example: =AI("write a thank you email and personalize it to the specific gift that was received", A2:C2)

Use the AI function

  1. On your computer, open a spreadsheet from Google Sheets.
  2. In a cell, enter an AI function.
    • For example: =AI(“Generate slogan for event in 10 words or less”, A2)
  3. Select the cell or cells with an AI function.
  4. Click Generate and Insert.
  5. Optional: To refresh output, click Refresh and Insert.

Tip: When you click “Generate and Insert” or “Refresh and Insert,” generated content is inserted and the cell edit is attributed to you in version history.

You can use the AI function to:

  • Generate text: To generate text tailored to your data, Gemini for Workspace uses relevant information from your sheet.
  • Summarize information: To help you understand your data, Gemini for Workspace analyzes the content of your spreadsheet and extracts important key takeaways.
  • Categorize information: To help you detect patterns, Gemini for Workspace categorizes your data into groups. This includes sentiment analysis.

An animation that demonstrates how to use the AI function by describing the desired action with a specific prompt.

Check some samples

  • Generate new text
    • =AI(“Generate slogan for event in 10 words or less”, A2)
    • =AI("Create an email to the reviewer addressing specific items in their reviews.", A2:G2)
    • =AI("develop a list of keywords for the job title based on the summary of duties.", A2:C2)
  • Summarize input cell or range
    • =AI("For the customer, write a one sentence summary of their feedback.", A2:D2)
    • =AI("You are the owner of a pet sitting business. Write a 2 sentence summary for the customer about their pet’s last stay. Be a little funny.", F2)
    • =AI("List in bullet points the main themes of the book summary.", D2)
  • Categorize inputs based on given definitions or generic categories
    • =AI("Classify the preview as either a spam email or not a spam email.", D2)
    • =AI("Categorize the customer inquiry as a compliment, exchange request, or return request.",C2)
    • =AI("Classify the restaurant by which New York City borough it belongs to. Use the neighborhood to help.", A2:C2)
  • Analyze sentiment
    • =AI("Classify the sentiment of the realtor analysis.”, D2)
    • =AI("Perform sentiment analysis on the emails sent by the customers to the barbershop.", C2)
    • =AI("Classify the body of the email, as either positive, negative, or neutral.", D2)

Tip: If you want to refer to two ranges that aren’t contingent, you can use concatenation in the prompt. However, if there’s a change in the data in ranges that are part of the prompt, you don’t get a prompt to refresh the data.

For example, if you use the function =AI("Find the major themes in the customer feedback of "&B2&" using the comments: "&D2&""), when B2 or D2 change, you need to manually determine when to refresh the data.

Syntax

AI(“prompt”,[range])

  • Prompt: A specific prompt that describes your desired action.
  • Range: This is optional. It’s the range that the prompt refers to when it generates data.

Learn about the limitations of the AI functions

  • Responses are limited to text.
  • The AI function doesn’t have access to your entire spreadsheet or other files in your Google Drive.
    • To provide data or context to your prompt, add the data to your current spreadsheet and use the optional input argument.
  • You can’t undo or redo your function.
    • You can regenerate your output instead.
  • You can’t have more than one function with the same name in Sheets. If you build a custom function with the name “=AI,” the custom function remaps to the Sheets AI function.
  • Embedded AI functions aren’t supported.
    • For example: =IF(AI(“sentiment analysis”, A2)),”negative”,0)
  • If “AI function not available” shows, it could mean that:
    • You're not a participant in the Workspace Labs or Alpha program.
    • You don’t have access to the AI function because of your Admin settings or your language setting, which should be set to English. Learn how to change your language setting.
  • The AI function has short term and long term generation limits. If you reach a long term limit, you temporarily can’t click “Generate.” You can wait for 24 hours and then try again.
  • You can select multiple cells with AI functions and generate outputs; however, only the first 200 selected cells with AI functions will be generated. You can wait for the generation to complete and select more cells to generate outputs.

Give feedback on this feature

To provide general feedback on this feature, at the bottom, go to Help & feedback Help & feedback.

To report a legal issue, create a request.

Learn about Gemini feature suggestions

  • Gemini feature suggestions don’t represent Google’s views, and should not be attributed to Google.
  • Don’t rely on Gemini features as medical, legal, financial or other professional advice.
  • Gemini features may suggest inaccurate or inappropriate information. Your feedback makes Gemini more helpful and safe.
  • Enterprise end users can submit feedback about their experience using this feature. End users are informed before they submit feedback that the feedback data shouldn’t contain personal, sensitive, or confidential information.
true
Visit the Learning Center

Using Google products, like Google Docs, at work or school? Try powerful tips, tutorials, and templates. Learn to work on Office files without installing Office, create dynamic project plans and team calendars, auto-organize your inbox, and more.

Search
Clear search
Close search
Main menu
9079896822479076708
true
Search Help Center
true
true
true
true
true
35
false
false
false
false