Gemini in Google Sheets: Two Ways to Use It
If you search for Gemini in Google Sheets, you will find two different things described as the same thing. One is Google's own Gemini side panel inside Sheets. The other is Gemini running as a formula, so that every row of a column gets its own answer. They solve different problems, and picking the wrong one is the main reason people get frustrated.
This guide is for anyone with a sheet full of text, such as expenses, keywords, company names or survey answers, who wants Gemini to do something to each row. I will explain how the side panel works in general terms, then show how to connect Google Sheets to Gemini with your own API key and run it as a formula with SheetAI. There are four worked examples, a comparison table, and an honest section on when the side panel is the better choice.
Option A: The Built-In Gemini Side Panel
Google has added Gemini to Sheets as a side panel. You open it from the sheet, type a request in plain language, and it responds in the panel. In general terms it can help you create a table, suggest a formula, or summarise what is in a sheet.
To use it, you need a Google Workspace or Google AI plan that includes Gemini. Which plans include it, and what they cost, changes over time, so check Google's current plan pages rather than relying on a blog post. If the Gemini option does not appear in your Sheets, your account probably does not have access yet.
The side panel is a conversation. You ask, it answers, and you decide what to do with the answer. That makes it very good for one-off help and less suited to repeating the same task on a thousand rows.
Option B: Gemini as a Formula with SheetAI
The second route is to call Gemini from a cell. SheetAI is a Google Sheets add-on from the Google Workspace Marketplace that adds formulas which send a prompt to an AI model and return the result in the cell. Because it is a formula, you write it once and drag it down.
It uses your own Gemini API key, so you pay Google directly for what you use and SheetAI itself is free. If you do not want to manage a key, hosted plans start at $12/month, listed on the pricing page. SheetAI runs in Google Sheets only, not in Microsoft Excel.
Here are the two ways to call Gemini:
=SHEETAI(prompt, 1000, 0.4, "g")
=GeminiAI(prompt)
The first uses the general SheetAI function with the model code "g" for Gemini Flash. The numbers are the maximum output length in tokens and the temperature. The second is a shorter call that goes directly to Gemini.
Side Panel vs Formula at a Glance
| Gemini side panel | Gemini formula (SheetAI) | |
|---|---|---|
| Best for | One-off help, explaining, building a first draft of a table | The same task on every row of a column |
| How you use it | Type a request in the panel | Write a prompt in a cell and drag it down |
| Output | A reply in the panel that you act on | A value in each cell, ready to filter and sort |
| Repeatable | You ask again each time | The formula reruns on new rows |
| Access | Needs a Google Workspace or Google AI plan with Gemini | Your own Gemini API key, or a hosted plan |
| Cost | Included in your plan | You pay Google for tokens used, or use a hosted plan |
Neither replaces the other. I use the panel when I do not know how to approach a problem, and the formula once I know exactly what each row needs.
How to Add Gemini to Google Sheets
Step 1: Install SheetAI
Install it from the Google Workspace Marketplace. Open a sheet and choose Extensions > SheetAI App > Launch. The sidebar opens on the right.
Step 2: Get a Gemini API Key from Google AI Studio
- Go to aistudio.google.com and sign in with your Google account.
- Open the option to get an API key and create a new key.
- Copy it. Treat it like a password, because anyone with the key can use your quota.
The Gemini models page in the docs lists the options SheetAI supports.
Step 3: Paste the Key into the Sidebar
In the SheetAI sidebar, open the settings and paste the key into the Gemini field, then save. That is how you connect Google Sheets to Gemini: the add-on holds the key and sends your prompts to Google when a formula runs.
Step 4: Write Your First Formula
Put some text in column A and try this in B2:
=SHEETAI("Categorise this expense as one of: Travel, Software, Meals, Office, Other. Reply with the category only. Expense: "&A2, 10, 0, "g")
Drag it down. Each row sends its own prompt, and the result lands in the cell.
Worked Example 1: Categorise Expenses
Expense exports usually have messy merchant descriptions. A closed list of categories and a temperature of 0 keep the output consistent.
| A | B | |
|---|---|---|
| 1 | Expense | Category |
| 2 | Uber trip airport to office | Travel |
| 3 | Figma annual team plan | Software |
| 4 | Team lunch at Saffron Kitchen | Meals |
| 5 | Printer paper and toner | Office |
| 6 | Notion workspace renewal | Software |
| 7 | Train tickets Delhi to Jaipur | Travel |
If you only need one label from a fixed list and do not care about the model, =SHEETAI_CLASSIFY(A2, "Travel, Software, Meals, Office, Other") is shorter. The classification guide goes into detail. Use the model argument version when you want Gemini specifically or need a longer instruction.
Worked Example 2: Write SEO Meta Descriptions from Keywords
Give it the keyword, the page type and the length limit, and ask for a plain sentence.
| A | B | |
|---|---|---|
| 1 | Keyword | Meta description |
| 2 | standing desk for small rooms | Compact standing desks that fit a small room without crowding it. Compare sizes, heights and storage options, then pick the one that suits your space. |
| 3 | how to descale a kettle | Descale a kettle in four easy steps using ingredients you already have at home. Follow the guide and get fresh tasting tea again. |
| 4 | beginner running plan 5k | A simple 5k plan for beginners with three short runs a week and rest days built in. Read the full schedule and start at your own pace. |
| 5 | vegan lunch box ideas | Easy vegan lunch box ideas that keep well until midday. Browse the list and pick a few to prepare this weekend. |
Models are not precise at counting characters. Add a normal formula next to it, =LEN(B2), and regenerate the rows that are over the limit. Keep the keyword list honest too: the AI writes the sentence, but you still decide which pages are worth targeting.
Worked Example 3: Clean Inconsistent Company Names
CRM exports often have the same company written five ways. Give Gemini a rule for how to write the clean version.
| A | B | |
|---|---|---|
| 1 | Raw name | Clean name |
| 2 | northwind logistics pvt. ltd. | Northwind Logistics |
| 3 | NORTHWIND LOGISTICS | Northwind Logistics |
| 4 | Brightleaf Tea Co., Inc | Brightleaf Tea Co |
| 5 | harbour studio ltd | Harbour Studio |
| 6 | HARBOUR STUDIO | Harbour Studio |
| 7 | Loomly Home Inc. | Loomly Home |
For a pattern that is hard to describe in words, =SHEETAI_FILL(examples_range, inputs) learns from example rows you have already corrected. See the SHEETAI_FILL docs. For simple tidy-ups such as trimming spaces or changing case, normal functions like TRIM and PROPER are faster and free, so use those first.
Worked Example 4: Summarise Survey Answers
Open-text survey answers are where a formula saves the most reading. Ask for a short summary and a sentiment word you can filter on.
=SHEETAI("Summarise this survey answer in under 15 words, then add a dash and one word: Positive, Neutral or Negative. Answer: "&A2, 60, 0.2, "g")
I put the sentiment word at the end so it is easy to split out later. For a cleaner split, use two columns: one with =SHEETAI_SUMMARIZE(A2) and one with =SHEETAI_CLASSIFY(A2, "Positive, Neutral, Negative"). The summarise docs cover the options.
Prompt Tips for Gemini Formulas
- Say exactly what the output should look like: "Reply with the category only".
- Use a closed list for anything you plan to filter or pivot on.
- Set the second argument to the shortest output you can live with. A label needs 10 tokens, a meta description about 120.
- Use temperature 0 to 0.2 for labels and cleanup, and 0.5 or more for writing.
- Put the cell reference at the end of the prompt, after the instructions.
- The AI only sees the cells you reference. If the answer depends on context such as a style guide, include it in the prompt.
Keeping the Cost and Mistakes Down
Results are cached, so the same prompt with the same input does not get billed twice. Once a column is finished, copy it and use Paste special > Values only so it never recalculates. The page on preventing formula recalculation explains why this matters.
Fill long columns in batches of 50 to 100 rows. Google Sheets custom functions time out after about 30 seconds per cell, so a huge fill in one go can leave errors you then have to redo. Spot-check a sample of every column before you rely on it.
When the Side Panel Is the Better Choice
The formula is not always the right tool. Choose the built-in Gemini side panel when:
- You are exploring and do not yet know what you want from the data.
- You need help writing a normal formula, such as a
QUERYorARRAYFORMULA, rather than AI output on each row. - You want a one-off summary of a sheet or a first draft of a table.
- You do not want to create or manage an API key.
- You are working in a Workspace account where Gemini is already included and the task is small.
Choose the formula when you have a repeatable per-row task, want results you can filter and share as plain values, or want to mix Gemini with other models in the same sheet. Neither option fixes bad source data, and both can be wrong, so read a sample.
Frequently Asked Questions
How do I use Gemini in Google Sheets?
You can use Google's built-in Gemini side panel if your account has a plan that includes Gemini, or run Gemini as a formula with SheetAI using your own API key. The formula route is the better one for repeating a task on every row.
How do I add Gemini to Google Sheets?
Install SheetAI from the Google Workspace Marketplace, open Extensions > SheetAI App > Launch, paste a Gemini API key into the sidebar settings, then use =SHEETAI(prompt, 1000, 0.4, "g") or =GeminiAI(prompt) in a cell.
How do I connect Google Sheets to Gemini?
Create an API key in Google AI Studio at aistudio.google.com, then paste it into the SheetAI sidebar. SheetAI sends the prompts from your formulas to Gemini and returns the answers in the cells.
Is Gemini for Google Sheets free?
SheetAI is free when you use your own key, and you pay Google directly for the tokens you use. Google's side panel depends on your Google plan, so check Google for current details. SheetAI hosted plans start at $12/month, see pricing.
Can I use Gemini with other models in one sheet?
Yes. The fourth argument chooses the model per formula, for example "g" for Gemini Flash, "c3s" for Claude Sonnet or "4o-m" for GPT-4o mini. Each provider needs its own key. The ChatGPT guide shows the OpenAI side of this.
Next Step
Pick one column in a real sheet, run the formula on five rows, and check the output before filling the rest. The get started page has the install steps, and the SheetAI docs list every function.