Sub topic 3
Preparing your data so Gemini can read it
Gemini in Sheets reads your sheet the way a careful colleague would. It looks at headers, ranges, and the types of values in each column. If the layout is messy, its tables, formulas, and charts are messy too. This chapter covers the layout rules that make prompts work.
This chapter assumes you can select ranges, write simple formulas such as SUM and IF, and open the Gemini side panel (covered earlier in this tutorial).
Why layout matters more than wording
A prompt like "Total the Amount for each Category" only works if Gemini can find a column called Category and a column called Amount, and if every row in those columns means the same thing. Three layout properties decide this:
- Headers. One row of short, unique column names at the top of the data.
- One record per row. Each row describes a single item, such as one expense or one order.
- Consistent types. Each column holds one kind of value: all dates, all numbers, or all text from a known set.
The same properties make your own formulas easier to write. SUMIF, QUERY, and chart ranges all assume them.
Headers
A header is the text in the first row of a column. Gemini uses headers as names for the data, and your prompts can refer to them directly.
Good headers are:
- Unique. Two columns both named "Amount" force Gemini to guess which one you mean.
- Short and specific. "Paid By" is better than "Who paid for this item (enter name)".
- In a single row. Avoid merged cells that span several columns, and avoid a title row above the headers if you can. If you need a title, leave a blank row between it and the data, or keep it on a separate sheet.
- Free of formulas and line breaks. Plain text keeps the name stable.
Compare two layouts of the same data.
| Layout | Problem |
|---|---|
| Row 1 is a merged title "Expenses 2026", row 2 has headers, row 3 has units | Gemini may treat row 1 or row 3 as data, and range suggestions start in the wrong place |
| Row 1 has the headers Date, Category, Description, Amount, Paid By | Every range starts at row 2 and every column has a clear name |
When you name a column in a prompt, use the header text exactly. "Amount" is safer than "the money column".
One record per row
A record is one row that describes one thing. Many spreadsheets built for printing break this rule in ways that are easy to see once you look for them.
- Subtotal rows inside the data. A row labeled "Groceries total" between groceries and rent rows will be counted as a record. A SUMIF over the column then adds the subtotal on top of the items, so the total is too high.
- Blank separator rows. Some tools stop reading at the first blank row and treat the rest as a different table.
- Wide layouts. Columns named Jan, Feb, Mar, and so on hold one value per month. This is fine for display, but it makes grouping and charting by month harder. A long layout with a Date column and an Amount column is easier for Gemini and for QUERY.
- Several values in one cell. A cell reading "Milk, Eggs, Bread" cannot be summed or grouped by item.
Here is a layout that follows the rule. Each row is one expense.
| Date | Category | Description | Amount | Paid By |
|---|---|---|---|---|
| 2026-11-01 | Groceries | Weekly shop | 82.40 | Sam |
| 2026-11-02 | Transport | Bus pass | 45.00 | Alex |
| 2026-11-03 | Groceries | Bakery | 12.75 | Alex |
This is the same table the sample prompts in this tutorial use: columns A to E, headers in row 1, and amounts in column D.
Put totals somewhere else, for example in a summary area on another sheet or to the right of the data after a blank column. A summary built with QUERY or a pivot table is better than typed totals, because it updates as records are added.
Consistent types
Sheets stores each cell as a number, a date, a piece of text, or a boolean (TRUE or FALSE). A column that mixes these causes quiet errors, because the sheet does not warn you.
Numbers stored as text
A value such as $82.40 typed with a stray space, or 82,40 in a locale that expects a period, may be stored as text. Text cells are ignored by SUM and break arithmetic. Signs that a number is text:
- It is left-aligned by default, while real numbers are right-aligned.
- The status bar shows a count but no sum when you select the column.
=ISNUMBER(D2)returns FALSE.
To find all text values in a numeric column, use a helper formula in an empty column:
=ARRAYFORMULA(IF(D2:D="", "", IF(ISNUMBER(D2:D), "ok", "TEXT")))Any row that shows TEXT needs fixing. Retyping the value, or using Format > Number > Number on the column and then re-entering the cells, usually converts it. Delete the helper column when you are done, or Gemini will see it as part of your data.
Dates
A real date is a number that Sheets displays as a date. A text date such as Nov 3rd cannot be sorted by time or grouped by month. Prefer one unambiguous format, and apply it with Format > Number > Date. The ISO form 2026-11-03 avoids confusion between day-first and month-first locales. Check the spreadsheet locale in File > Settings, because it decides how 03/11/2026 is read.
Category columns
A category column holds text from a limited set. Variants of the same value count as different groups:
Groceries,groceries, andGroceries(with a trailing space) can end up as separate groups in QUERY or a chart. SUMIF treats the first two as equal, because its text matching ignores case, but a trailing space still makes a different value.TransportandTransitare two groups unless you merge them.
You can limit the variants with a drop-down list. Select the column, choose Data > Data validation, add a rule of the type Drop-down, and list the allowed values. New entries then have to match the list.
To clean up existing values, Data > Data cleanup offers options such as Trim whitespace and Remove duplicates. Use Trim whitespace first, and then check the list of distinct values with =UNIQUE(B2:B) in a spare area.
Blanks
Blank cells are fine in optional columns, such as a notes column. They cause trouble in columns that every record should have, such as Amount. A blank Amount is treated as zero by SUM and as missing by AVERAGE, so the two functions disagree about the data. Fill the gap, or decide on a rule for it and state the rule in your prompt.
Check the layout in one minute
Before you open the side panel, run through this list.
- Row 1 holds unique, short headers, and no cells are merged.
- Every row below is one record, with no subtotals or blank rows.
- Each column has one type. Select it and check that the status bar shows a sum for numeric columns.
- Category values are trimmed and consistent.
- Nothing else sits in the same columns below or beside the data without a blank row or column between them.
The diagram shows how these checks lead to a prompt that Gemini can answer well.
Using a table object to fix the range
Sheets offers a table object that turns a range into a named, typed structure. Select the data, then choose Format > Convert to table. A table gives each column a type (such as Date, Currency, or Dropdown), keeps the header row fixed, and extends itself when you add rows below it.
For Gemini, this helps in two ways. The table has a name and column names that you can refer to in a prompt, and the range grows with the data so you do not have to restate A1:E50 each time. Column types also catch some of the type problems described above, because a value that does not fit the type is flagged.
Convert to table is not required. A plain range with good headers works, and the sample formulas in this tutorial use plain ranges such as D2:D and A1:E. If your sheet already has tables, mention the table or column names in prompts.
Giving Gemini the range explicitly
Even with clean data, name the range in your prompt. Compare:
Make a chart of spending.Create a column chart of total Amount by Category using the data in A1:E50, with the title "Spending by Category".The first leaves Gemini to guess the columns, the grouping, and where the data ends. The second names all three. If the data grows, an open-ended range such as A1:E includes new rows, but it also includes anything you later place below the data. This is the main reason to keep the area under your data empty.
When the sheet has several tabs, say which one: "On the Expenses sheet, in A1:E50, ...". Without that, the request may be applied to the active sheet.
Common errors and how to read them
| Symptom | Likely cause | Fix |
|---|---|---|
| Total is lower than expected | Some amounts are stored as text | Find them with the ISNUMBER helper, then convert |
| Total is higher than expected | A subtotal row is inside the range | Move subtotals out of the data |
| One category appears twice in a chart | Spelling, case, or trailing space differs | Trim whitespace, then standardize values |
| Months appear in alphabetical order | Month names are text, not dates | Store real dates and group by month |
| Gemini describes the wrong columns | Duplicate or missing headers | Give every column a unique header |
| Formula covers only part of the data | A blank row splits the range | Remove blank rows or name the full range |
The diagnosis is the same each time. Compare what the sheet contains with what the prompt assumed, and change whichever one is wrong.
Exercise
A sheet has headers in row 1 (Date, Category, Description, Amount, Paid By). Row 12 contains "Groceries total" in column B and 95.15 in column D. Row 20 has the Amount "45,00" left-aligned. You ask Gemini for the total Amount by Category. Name the two problems that will distort the result, and say how each changes the total.
Show answer
Row 12 is a subtotal inside the data, so it is counted as a record and the totals are too high (the grouping may also create a separate "Groceries total" category). The Amount in row 20 is stored as text, so SUM and SUMIF ignore it and the total is too low. Fix both by moving the subtotal out of the data range and converting the text to a real number, for example by retyping it as 45.00 in a numeric format.
Exercise
Write a formula that goes in an empty column and marks each non-blank value in D2:D as "ok" when it is a number and "TEXT" when it is not, leaving blank rows empty. Why should you delete it afterward?
Show answer
=ARRAYFORMULA(IF(D2:D="", "", IF(ISNUMBER(D2:D), "ok", "TEXT"))). Delete it afterward because a helper column next to the data is part of the area Gemini and open-ended ranges read, so it can show up in generated tables, formulas, or charts.