AI for data analysis: analyze CSV and Excel files without wrong answers

AI for data analysis: analyze CSV and Excel files without wrong answers

AI for data analysis means asking a chat assistant or spreadsheet copilot questions about your data in plain English while it writes and runs the code (usually Python) that produces the answer. This guide shows which tools to use, a step-by-step workflow, prompts that work, how to catch wrong numbers, how to make results reproducible and what not to upload.

In shortTL;DR
  • Use a tool that runs code on your file (ChatGPT, Claude, Copilot in Excel, Gemini in Sheets); a model that only reads the text of a table will guess at math.
  • Start every analysis with a data check: row count, column types, missing values and duplicates, before any chart or conclusion.
  • Ask to see the code and verify at least a few numbers yourself with a pivot table or a formula.
  • Save the generated code as a script or notebook so you can rerun the analysis on next month's data.
  • Remove or mask personal data before uploading, and check your plan's training and retention settings.

How do you use AI for data analysis?

You use AI for data analysis by giving a tool that can run code your file and a clear question, then checking its work. Modern assistants don't do math in their heads: they write Python, run it on your data in a sandbox, and show you the result, the chart and the code.

The basic loop looks like this:

  1. Upload a CSV or Excel file (or open it in a spreadsheet with an AI sidebar).
  2. Ask the tool to describe the data and flag quality problems.
  3. Ask specific questions, one at a time.
  4. Check the numbers against the source.
  5. Export the chart, the cleaned table and the code.

This works well for exploring a dataset, cleaning messy exports, building charts, and answering business questions like "which product lines grew last quarter and why". It works less well when the question is vague, the data is undocumented, or the stakes are high and nobody checks the result.

The rule that matters most: only trust analysis from a tool that executes code. A language model reading a pasted table will often produce plausible-looking totals that are wrong. Our guide to AI hallucinations explains why.

Which AI tools can analyze data?

The main options are chat assistants with code execution, AI built into spreadsheets, and coding agents. Pick by where your data lives and whether you will repeat the analysis.

ToolHow it analyzesBest forWatch out for
ChatGPTRuns Python on uploaded spreadsheets and CSVs, returns tables, charts and filesQuick exploration of a filePlan-dependent upload limits
ClaudeCode execution and file creation: Python on uploaded CSV, TSV and other files; can produce XLSX and PNG chartsExploration, cleaning, report files30MB per file
Copilot in ExcelAnswers questions about tables in your workbook, runs Python behind the scenes, optional advanced analysis modeData already in ExcelNeeds tables or table-like ranges; inserted results are static
Gemini in Google SheetsSide panel answers questions, finds trends and generates chartsData already in SheetsCharts insert as static images
Coding agent (Claude Code, Codex)Writes scripts, notebooks and SQL in a project you can rerunRecurring reports, large data, databasesNeeds a code environment

A few specifics from the official docs:

  • Claude. The Claude help center lists "CSV, TSV, and other files for data analysis and visualization," a maximum of 30MB per file, and output as Excel, Word, PowerPoint, PDF and image charts. The feature is the Code execution and file creation toggle under Settings > Capabilities.
  • Copilot in Excel. Microsoft's support page says Copilot handles Q&A, summary statistics, trends, outliers, what-if analysis and clustering on single tables or table-like ranges, and that "unstructured data is not supported." You can expand the Python code behind an answer, or switch to advanced analysis mode, which opens a new sheet with Python you can edit.
  • Gemini in Sheets. Google's announcement says analysis is most consistent on files under 1 million cells and recommends "clear headers and no missing values."

If your work lives mainly in spreadsheets, our guide to AI in Excel and Google Sheets covers formulas, cleanup and pivots in more depth.

A step-by-step AI data analysis workflow

A reliable workflow separates checking the data from analyzing it, and asks for evidence at every step. Use these steps with any tool that runs code.

1. Prepare the file

Spend five minutes before uploading:

  • One table per sheet, one header row, no merged cells.
  • Clear column names (order_date, not Col F).
  • Remove columns you don't need, especially personal data.
  • Add a short data dictionary if column meanings aren't obvious.

2. Profile the data first

Ask for a profile before any question. This catches the problems that cause most wrong answers.

prompt
I've uploaded sales_2026.csv. Before any analysis:1. Report the row and column count.2. List each column with its inferred type and 3 example values.3. Count missing values and duplicates per column.4. Flag anything odd: dates stored as text, negative quantities, outliers, mixed currencies.Don't clean or change anything yet. Show the code you ran.

Compare the row count with what you expect. If your export has 48,210 orders and the tool reports 47,900, find out why before going further.

3. Agree on cleaning rules

Decide how to handle each problem and say so explicitly. "Drop rows with no order_date; convert EUR to USD at 1.08; treat negative quantities as returns, keep them in a separate column." Ask the tool to report how many rows each rule affected.

4. Ask specific questions

Narrow questions get checkable answers. Compare:

Weak promptStrong prompt
Analyze this dataTotal revenue by month for 2026, as a table and a line chart
Find insightsWhich 5 products had the largest revenue change between Q1 and Q2, in dollars and percent?
Why did sales drop?Split the June revenue drop by region and channel. Which segment explains most of it?
Make a chartBar chart of revenue by region, sorted descending, labeled in thousands of dollars

Ask one question per message. Long multi-part prompts make it harder to see which step went wrong.

5. Verify, then interpret

Check the numbers (see the next section), then ask for interpretation, and treat it as a hypothesis. "Revenue dropped because of the price change" is a claim the data may support or merely be consistent with.

6. Export everything

Download the cleaned data, the charts and the code. The code is the part people forget, and it is what lets you rerun the analysis next month.

How do you check AI analysis for errors?

You check AI analysis by reproducing a few numbers independently, reading the code for filters and joins, and watching for rows that disappear. Most errors come from a misread column or a silent assumption, not from bad arithmetic.

A five-minute verification routine:

  1. Row counts at each step. Ask: "How many rows before and after each cleaning step?" Unexplained drops are the most common hidden error.
  2. Recompute two or three numbers yourself. Use a pivot table or a SUMIFS formula on the original file for one total and one segment.
  3. Read the code for filters. Look for date ranges, dropna() calls, and joins that might duplicate or drop rows.
  4. Check units and definitions. Is "revenue" gross or net? Are amounts in cents? Is the week starting Monday or Sunday?
  5. Ask the tool to argue against itself. "What could make this conclusion wrong? Which checks would disprove it?"

Typical errors and how to catch them:

ErrorSymptomCheck
Wrong column usedTotals far off from what you expectAsk which column it used for each metric
Rows silently droppedCounts lower than the sourceRow count before and after each step
Duplicates from a joinTotals higher than the sourceCompare sums before and after merging
Text treated as numbers or datesOdd sorting, missing monthsAsk for column types
Correlation read as causeConfident "because" statementsAsk what else could explain the pattern
Warning

Charts make wrong numbers look convincing. Verify the table behind a chart before you put the chart in a deck.

How do you make AI data analysis reproducible?

Make AI data analysis reproducible by saving the code as well as the answer, and running it as a script or notebook outside the chat. A chat transcript is a record of what happened once; a script is something you can run again.

Ask for a clean, rerunnable version at the end of a session:

prompt
Combine all the steps we used into one Python script, analysis.py, that:- reads the raw CSV path from a command-line argument- applies the cleaning rules we agreed on, printing row counts after each- writes cleaned.csv, summary.csv and the three charts as PNG filesUse pandas and matplotlib only. Add a comment above each step.

Then run it locally or in a notebook, and check that it reproduces the numbers from the chat. Next month, run it on the new export instead of starting a fresh conversation.

When data lives in a database, the reproducible unit is a SQL query. Ask the AI to write the query, review it, run it read-only, and keep it in version control. Our guide to AI SQL query generators covers giving the model your schema and keeping production data safe.

For analysis you repeat weekly, a coding agent working in a small repository is often the better tool: it writes the script, runs it, fixes errors and commits the result. If you want that to happen on a schedule without your laptop, Orkio offers a ready Data & reports project on an always-on cloud box where agents such as Claude Code can build and update these scripts.

What data should you never upload to an AI tool?

Don't upload data your company policy forbids, personal data you don't need for the question, or credentials. When in doubt, mask or aggregate first.

Practical rules:

  • Remove direct identifiers. Drop names, emails, phone numbers and addresses unless the question needs them. Replace customer IDs with random keys.
  • Aggregate when possible. Daily totals by region often answer the question as well as raw transactions.
  • Know your plan's training settings. Business, enterprise and API plans from major vendors generally exclude your data from model training. Consumer plans differ: Anthropic, for example, lets Free, Pro and Max users decide whether chats are used for training through a "Help improve Claude" privacy setting, as described in its consumer terms update. Check the equivalent data controls in any tool you use.
  • Watch network access. Claude's help center warns that hidden instructions in external files or websites can trick the model into sending data from its context to third parties, and recommends monitoring sessions and limiting network access.
  • Never paste secrets. No database passwords or API keys in chats; give a coding agent read-only credentials scoped to what it needs.

For a fuller policy, see our guide to using AI safely at work.

How to start analyzing data with AI today

Pick one real file and one real question, and run the full loop once:

  • Clean the file: one table, clear headers, no personal data you don't need.
  • Upload it to a tool that runs code and ask for the data profile prompt above.
  • Agree on cleaning rules and check the row counts.
  • Ask three specific questions and verify two numbers by hand.
  • Ask for one combined script and save it with the cleaned data.
  • Next time the data updates, rerun the script before opening a new chat.

Frequently asked questions

Can ChatGPT analyze Excel files?

Yes. ChatGPT accepts spreadsheet uploads such as XLSX and CSV and analyzes them by writing and running Python code, then returns tables, charts and downloadable files. Upload limits and available features depend on your plan, so check OpenAI's help center for current numbers.

What is the best AI tool for data analysis?

For one-off questions about a file, a chat assistant with code execution such as ChatGPT or Claude is the quickest. If your data already lives in a spreadsheet, Copilot in Excel or Gemini in Google Sheets keeps you in place. For recurring, large or database-backed analysis, a coding agent that writes scripts and SQL you can rerun is the better fit.

Is AI data analysis accurate?

The arithmetic is usually right when the tool runs real code, but the analysis can still be wrong because of a misread column, a wrong filter, silently dropped rows or a misleading conclusion. Always check row counts, spot-check a few figures by hand and read the code before you act on a result.

How big a file can I upload for AI analysis?

It depends on the tool. Claude's help center lists a 30MB limit per file for code execution and file creation, and Google advises keeping Sheets files under one million cells for complex Gemini analysis. For larger data, load it into a database and have the AI write SQL instead.

Is it safe to upload company data to an AI tool?

Only if your company's policy and your plan allow it. Business and enterprise plans usually exclude your data from model training, while consumer plans may need you to switch training off in settings. Remove names, emails and other personal data you don't need for the question.

SOURCES

  1. Claude Help Center: Create and edit files with Claude
  2. Microsoft Support: Get direct answers to your data analysis questions (Copilot in Excel)
  3. Google Workspace Updates: Generate charts and insights with Gemini in Google Sheets
  4. Anthropic: Updates to our consumer terms
  • #data analysis
  • #chatgpt
  • #claude
  • #excel
  • #csv
Orkio team

The team building Orkio. We write about putting AI to work: coding agents that run overnight, always-on boxes and pull requests ready by morning.

Keep reading

All posts

07:06 · YOU MERGED #128

Go to sleep. Wake up to pull requests.

Start for $19 a month
© 2026 Orkio · Hosted in Europe TürkçeStatus