How to Analyze CSV and Spreadsheet Data with Claude
November 2026 · 7 min read
Quick answer
To analyze CSV or spreadsheet data with Claude, turn on code execution and file creation in Settings under Capabilities, upload the file, and ask Claude to profile it before answering any business question. With code execution on, Claude runs Python against the actual rows instead of estimating from text, and it can return charts and .xlsx files. Then verify: reconcile row counts, ask for the code, and recompute at least one key figure yourself.
ClaudeKit field note
Why this belongs on ClaudeKit
This guide is included because it connects a broader AI change back to the way ClaudeKit users work: long Claude sessions, prompt reuse, portable context, and recoverable workflows.
How to use it in Claude
Read it as a workflow note, then turn the useful parts into saved prompts, forked tests, or exported checklists inside Claude.
Editorial bar
The page should leave you with a decision, checklist, or example you can use immediately, not just a summary of AI news.
Two Ways Claude Reads Your Data
This distinction decides whether you can trust the numbers. Claude can encounter a CSV in two ways:
| Mode | What happens | Safe for |
|---|---|---|
| Code execution on | Claude writes and runs code in a sandbox, loads the file, and computes results over every row. | Totals, group-bys, joins, statistics, charts, cleaned exports. |
| Code execution off (or pasted text) | The data is read as text in the conversation, like any other prompt. | Describing columns, spotting obvious issues, reasoning about a few dozen rows. Not arithmetic over thousands of rows. |
Language models are good at reading and poor at mental arithmetic over large tables. If you paste 5,000 rows and ask for a sum without code execution, you may get a confident, wrong number. Claude's help center also notes that XLSX uploads require code execution and file creation to be enabled.
Setup: Turn It On and Prepare the File
- Enable the feature. On web or desktop, open Settings, go to Capabilities, and turn on code execution and file creation (labeled "Create and edit files" in newer layouts). On Team and Enterprise, an owner may control this at the organization level.
- Check the size. The help center lists a 30MB per-file limit for this feature. Large exports usually shrink a lot if you drop unused columns.
- Strip sensitive columns. Remove emails, names, and payment details you do not need. Hash customer IDs if you only need to count distinct customers.
- One table per sheet. Merged header cells, notes in row 1, and totals rows at the bottom all confuse parsers. Keep a single header row.
- Write a short data dictionary. Two lines per ambiguous column ("status: paid, refunded, chargeback; cancelled orders never charged") prevents most wrong conclusions.
One caution from the help center: files and websites can carry prompt injection that causes Claude to run untrusted code. Be careful analyzing files from unknown sources, especially with network access on.
First Prompt: Profile Before You Analyze
The biggest mistake is asking the business question first. Ask Claude to describe the data, then confirm its understanding matches reality. This prompt catches most problems in one pass:
I've uploaded orders_2026_q3.csv. Before any analysis, profile it.
Using code, report:
1. Row count and column count.
2. For each column: inferred type, % missing, number of distinct
values, and 3 example values.
3. Date range of any date columns and the timezone if detectable.
4. Exact duplicate rows, and duplicates on order_id alone.
5. Anything that looks like a totals row, test data, or a unit
mismatch (e.g., cents vs dollars).
Data dictionary:
- status: paid | refunded | chargeback | cancelled
(cancelled orders were never charged)
- amount: order value in USD, before tax
Do not answer business questions yet. End with a list of
assumptions you would need me to confirm.Read the assumptions list carefully. If Claude says "amount appears to be in cents" and you know it is dollars, correct it now. Every later answer inherits this step.
Analysis Prompts That Hold Up
Once the profile is right, ask narrow questions with explicit definitions. Vague metrics produce confident numbers with hidden choices inside them.
| Question type | Prompt pattern | What to check |
|---|---|---|
| Rate or ratio | "Refund rate = refunded orders / paid + refunded orders. Exclude cancelled." | Numerator and denominator counts are both shown. |
| Trend | "Weekly revenue, weeks starting Monday, in UTC. Show the table, then a line chart." | First and last weeks may be partial; ask Claude to flag them. |
| Segment comparison | "Compare average order value by channel. Include count per channel." | Small segments with large swings are noise, not insight. |
| Anomaly hunt | "List the 10 days with the largest deviation from the 28-day median and possible causes in the data." | Causes are hypotheses; confirm against your calendar. |
| Cleaned output | "Return a cleaned .xlsx with one sheet per region and a summary sheet." | Open it and spot-check rows against the source. |
Add "show the code you ran" to any question whose answer you will repeat to someone else. You do not need to read Python fluently; filter conditions like status == 'paid' are readable enough to catch the wrong definition.
Verifying the Numbers: A Checklist
Before a figure leaves the chat, run through this list:
- Row count reconciles with what your spreadsheet shows when you open the same file.
- One total recomputed by hand. A single SUM or pivot table in your spreadsheet app for the headline number.
- Filters are visible. The code or explanation names every exclusion (test orders, cancelled, internal accounts).
- Dates are right. Timezone, week start, and whether the range includes partial periods.
- Duplicates handled. Exports often repeat an order once per line item.
- Units consistent. Cents versus dollars, gross versus net, with or without tax.
- Rerun survives. Ask the same question in a fresh chat. If the number changes, a definition is ambiguous.
Worked Example: The Refund Rate That Was Wrong
Here is an illustrative scenario. A founder uploads a Q3 export with 14,200 rows and asks, "What's our refund rate?" Claude, with code execution on, reports 6.1%.
The profiling step would have revealed two things. First, the export has one row per line item, so 14,200 rows represent about 9,800 orders. Second, 600 orders are cancelled and were never charged, but the first calculation counted them in the denominator. Redefining the metric explicitly ("unique order_id; refunded / (paid + refunded); exclude cancelled") produces a different and correct figure, and the code makes the change auditable.
Nothing about the model was broken. The question was underspecified, and Claude made reasonable default choices. Your job is to remove the defaults that matter.
A good follow-up in this situation is to ask Claude to compute the metric three ways (per row, per unique order, and per unique order excluding cancelled) and show all three side by side. Seeing the spread tells you how sensitive the number is to the definition, and which version your finance or support team actually uses. If two of the three agree with your spreadsheet pivot, you know which definition you are reporting.
When Not To Use Claude for This
- Recurring dashboards. If you need the same metric every Monday, build it once in your BI tool or spreadsheet. Use Claude to design the query, not to rerun it weekly.
- Regulated or contractually restricted data. Check your organization's policy and plan before uploading.
- Files far above the limit. Aggregate first (daily totals instead of raw events) or sample, and say so in your conclusions.
- Decisions that hinge on one number you have not reproduced outside the chat.
Also note that the help center says file creation draws more from your plan's usage limits than regular chats. Large analysis sessions are a common reason Claude usage runs out fast.
ClaudeKit Workflow Note
Save the profiling prompt above in ClaudeKit's prompt library so every new dataset starts with the same checks; swap in the file name and data dictionary each time. When you have a verified figure, pin that message so the final numbers and their definitions are one click away in the Workspace panel, not buried under exploratory charts.
Because analysis sessions can be usage-heavy, the usage circle in the corner of claude.ai is worth a hover before you start a large file, so you know how much of your session and weekly limit is left. When you are done, export the chat as Markdown or JSON: the prompts, code, and answers become an audit trail you can attach to the decision.
Sources and further reading
- Claude Help Center: Create and edit files with Claude
- Claude Help Center: Upload files to Claude
- Claude pricing
FAQ
Can Claude analyze Excel files?
Yes. Claude's help center says XLSX uploads require code execution and file creation to be enabled, and with it on Claude can also return .xlsx files.
How big a CSV can I upload to Claude for analysis?
The help center lists a 30MB per-file limit for code execution and file creation. Drop unused columns or aggregate rows if your export is larger.
Is Claude accurate at spreadsheet math?
With code execution on, calculations run as code over the actual rows, which is far more reliable than reading numbers as text. Definitions can still be wrong, so verify key figures.
Does analyzing files use more of my Claude limit?
Yes. Claude's help center says file creation consumes more of your plan's usage limits than regular chats.
Should I upload customer data to Claude?
Only what the analysis needs and only if your organization's policy allows it. Remove names, emails, and payment details, and hash IDs when you only need counts.
Claude power users
Use Claude harder without losing your place.
ClaudeKit adds saved prompts, exports, conversation forking, and an on-page usage circle when Claude returns valid data.
Add to Chrome - Free