Analyse data with AI’s code tools, and check the working
Let an assistant write and run code on your spreadsheet, then check its working. A workflow for analysis you can trust, and rerun next month.
Video transcript
Upload a spreadsheet, ask a question and get an answer in seconds. Here’s how to make sure that answer is actually right.
Assistants with a code tool don’t do sums in their heads. They load your file, write a short program, run it in a sealed-off space, and report what it found.
The arithmetic is reliable. The risk is in the choices the code makes: which rows it kept, how it read each column, and what it assumed.
So before any answers, ask for a profile of the data: how many rows and columns, what type each column is, what’s missing, and the range of dates it found.
Watch for the classic traps: misread columns, rows quietly dropped, dates read month first, averages that hide the detail, and patterns mistaken for causes.
Ask it to show its code and list every assumption. Then reconcile: the row counts and totals should match your original file before you trust a single chart.
Once it checks out, save the code. Next month you can rerun the same analysis on new data, and a colleague can see exactly what was done.
Take out personal data, use an approved tool, and copy the prompts from the full guide below.
In 30 seconds
- Ask for a profile of the data first: rows, columns, blanks and how it read each one.
- Reconcile before you believe: row counts and totals should match the source file.
- Save the code, so the analysis can be checked and rerun on next month’s data.
Ask a chatbot to total a column in its head and it can simply get it wrong. Give the file to an assistant with a code tool and it writes a short program, runs it and reports back. That’s far more reliable, but only if the program does what you think. New to this? Start with AI for spreadsheets.
What happens when you upload a file
Several assistants, including ChatGPT, Claude and Gemini, can load a spreadsheet or Jargon busterCSV: A simple spreadsheet file: plain text, with values separated by commas. you upload, write code for your question, usually in Jargon busterPython: A popular programming language, often used for data analysis. It’s what many AI assistants write when they work with your data., and run it in a Jargon busterSandbox: A sealed-off computing space where an AI can run code without touching your computer or other systems.. Inside Excel, Microsoft Copilot can analyse the data in your workbook.
- LoadReads your file into a table
- WriteWrites code for your question
- RunRuns it in a sandbox
- ReportTurns the output into an answer
The arithmetic is now done by code, so it’s reliable. The risk moves to the choices the code makes: which rows it kept, how it read each column, and what it assumed when the data was ambiguous. Those choices often go unmentioned unless you ask.
A workflow you can trust
- Describe the dataSay what one row is, such as an order or a line item, what each column means, the units, and how blanks are marked.
- Ask for a profile firstBefore any answers: rows and columns, each column’s type, missing values, duplicates and the range of dates it found.
- Ask one question at a timeIn plain English. Say how to treat awkward cases, such as refunds, test orders or blank regions.
- See the workingAsk for the code, or the formula, and a list of every assumption and filter it used.
- ReconcileRow counts and totals should match the source file. If rows went missing, find out where.
- Then chart itOnce the numbers check out, ask for charts with clear titles and units on the axes.
- Save the codeKeep it with the file, so you or a colleague can check it and rerun it on next month’s data.
I’ve uploaded [file name], an export of [what it is]. Each row is [one order, one line item or one customer]. Before answering anything, profile it: number of rows and columns, each column’s data type, missing values per column, duplicate rows, and the earliest and latest dates. Tell me whether you read the dates as day first or month first, and flag any column you’re unsure about. Don’t remove or change any rows yet.
Now answer this: [your question]. Show the code you ran. List every assumption and filter, and how many rows each step kept or removed. Finish with a check I can do myself: the row count and the total of [column] in the original file, and in the data you used.
Five ways a tidy answer goes wrong
- Misread columns“Amount” might include VAT, or “date” might be the order date, not the delivery date. Say what each column means.
- Rows quietly droppedBlank categories can vanish from a grouped total, and numbers stored as text, such as “1,200”, can be skipped. Compare row counts.
- Dates and unitsA common Python tool reads 03/04/2025 as 4 March unless told otherwise. Check units too: pounds or thousands of pounds.
- Averages that hide thingsOne huge order can drag an average up, and an overall trend can reverse within groups. Ask for the Jargon busterMedian: The middle value when numbers are put in order. Unlike the average, it isn’t pulled up or down by a few extreme values. and a breakdown.
- Correlation isn’t causeSales rose after the new website launched, but it was also peak season. A Jargon busterCorrelation: When two things tend to rise and fall together. On its own, it doesn’t show that one causes the other. doesn’t show why. Ask what else could explain it.
None of these raises an error. The code runs, the chart looks fine and the number is wrong. That’s why reconciling against the source matters more than rereading the answer.
Keep personal data out
Before you upload, remove what the question doesn’t need: names, contact details and free-text notes, where personal details often hide. Swapping names for ID numbers helps, but if the IDs can be linked back to people, the data can still count as personal data under Jargon busterUK GDPR: The UK law on personal data. It sets how organisations must collect, use and protect information about people..
Use a tool your organisation has approved, on a work account. Your file goes to the provider to be analysed, and one provider warns that hidden instructions in a file could trick its assistant into sending data out. For the basics, see using AI at work safely.
Check yourself
3 quick questions nothing is savedTools in this guide
- CChatGPTOpenAI’s general-purpose assistant for writing, questions, analysis and images.
- CClaudeAnthropic’s assistant, strong at long documents, careful writing and code.
- GGeminiGoogle’s assistant, built into Gmail, Docs and Android.
- MMicrosoft CopilotMicrosoft’s assistant across Windows, Edge and Microsoft 365 apps.
Sources (1)
- Create and edit files with ClaudeAnthropic, August 2026
Spotted a mistake? Tell us and an editor will check it.