An AI data analyst for spreadsheets that shows its working
Ask a question about a table in plain words and get an answer worked out by a small program that runs on every row, with the table, a chart and the code behind it.
Part of the guide AI employees
A trustworthy AI data analyst for spreadsheets does not read your rows and guess. It looks at the column names and a few sample rows, writes a short program to answer your question, runs that program on every row, and then describes only what the program worked out. You get a sentence or two, the result table, a chart, and the program itself, so anyone can check how the number was reached.
This is for people who live in spreadsheets but are not analysts: a franchise manager with monthly sales by branch, a sales lead with an export of accounts, an operations team with a log of site visits. It explains why the program approach matters, which questions it handles well, how to prepare a sheet, an example and how to run it on a timetable as an AI employee.
Why a chat model alone gets numbers wrong
Paste a large table into a general chat assistant and ask "which region grew fastest?" and you will usually get a confident answer. The trouble is how it was produced. A language model predicts text; asked to add up 3,000 rows it may skim, round, or lose rows past what it can hold at once. The answer sounds right and nothing shows you the arithmetic.
Writing code separates the two jobs. The model does what it is good at, turning your question into steps ("group by region, sum October and September, take the difference, sort"), and a computer does the counting exactly. If the code fails, the error goes back to be fixed. The words at the end are written from the program's output, so a figure that is not in the output has nowhere to come from.
How the Data analyst block works
In xMap Flows this is the Data analyst block. It follows the approach above with a few firm limits that keep it honest:
- xMap AI sees only the field names, their kinds and the first 20 rows. The program then runs on all of them, up to 5,000 rows.
- The program runs in a sandbox with no internet, no files and no access to your accounts, with a small amount of computing time.
- If the program fails, the error goes back to xMap AI to fix it, up to 3 times.
- The answer is written from the program's result only. A sentence containing a number that is not in the result is dropped, and the step says so.
- You choose what comes back: an answer and a table, the same with a chart, or every row with new fields added, such as its rank or its share of its city.
Questions that suit it, and ones that do not
It shines on questions with a precise answer hidden in many rows: totals and averages by group, the median rather than the mean, change between two months, the top or bottom few, the share of each category, rows that break a rule ("branches where returns exceed 5% of sales"). It can also work on two sources together, for example the places a flow found and your own store table, to count what is near each store.
It is the wrong tool for opinions ("which branch manager is best?"), for questions the data cannot answer ("why did sales drop?" when there is no column about causes), and for anything that needs data you do not have. Ask the narrow factual question first, then reason about the cause yourself.
A worked example
This example is made up. A chain of bike repair shops in Amsterdam keeps a sheet with one row per shop per month: shop, district, month, repairs, new bike sales, average ticket. The owner wants to know where repairs fell in October.
- She uploads the sheet as a CSV on the My data page, so it becomes a table the flow can read.
- She builds a flow: My data (the shops table), then Data analyst with the question "Which three shops had the biggest fall in repairs from September to October, and by how much?", giving back an answer and a table with a chart.
- She runs it once. The answer names three shops with their September and October repairs and the difference; the table lists every shop; the chart shows the change per shop.
- She opens How it worked it out and reads the program: filter the two months, group by shop, subtract, sort ascending, keep three. It matches what she would have done by hand.
Because the numbers came from code over every row, she can forward the answer to her area managers without re-adding the column herself.
Preparing a sheet so the program reads it right
- One header row, one meaning per column. Merged cells, two header rows and notes typed above the table confuse any program.
- No totals rows inside the data. A "Total" row at the bottom gets counted as one more shop.
- One unit per column. Mixing euros and thousands of euros, or minutes and hours, gives wrong sums that look fine.
- Dates as dates. Write months the same way in every row (2026-10 or October 2026, not both).
- Ask one question at a time. Two questions in one sentence often get one answered well and one skipped.
Running it every week as an AI employee
A one-off answer is useful; the same question answered every Monday is a report nobody has to build. Put a Schedule before My data and an Email after the Data analyst, and use {{analysis}} at the top of the email. Templates that already read your own table, such as Branch network review and Stores competing with each other, are good starting points: add the Data analyst where you want a precise figure rather than a written summary. The AI employees guide explains how such a flow becomes a member of the team with its own inbox thread.
You can also ask outside a flow. In Results and in Ask xMap, a question the ready-made charts cannot answer is offered to the Data analyst over your results, with the price shown first, and Pin to a dashboard runs the same program again on fresh results each time you open it.
Questions
Does the AI see all of my data?
No. xMap AI sees the column names, their kinds and the first 20 rows to write the program. The program runs on every row inside a sandbox with no internet or access to your accounts.
How big can the spreadsheet be?
The program works on up to 5,000 rows a run. Larger tables should be filtered first or split.
Can it read a Google Sheets file directly?
Bring the sheet in as a table on the My data page, from a CSV or a Google Sheets link, and point the block at that table.
What if the program has a bug?
The error goes back to xMap AI to be fixed, up to 3 times. You can always read the final program under How it worked it out.
Can it add new columns instead of answering?
Yes. Choose to give back the items with new fields, and each row goes on with the fields the program works out, such as a rank or a share.
Templates that do this
Read next
More on ai employees and automation · Every article · Templates