How to Use Claude Analysis Tool for Data Tasks
The Claude analysis tool is a built-in JavaScript code execution environment inside claude.ai that lets Claude actually run code instead of just describing what code would do. You use it by uploading a file (CSV, Excel, JSON, or plain text) or pasting data into a chat, then asking Claude a question about it — Claude writes JavaScript, executes it in a sandboxed environment, checks the output, and gives you a verified answer instead of a guess.
This matters because language models are notoriously bad at arithmetic and multi-step data manipulation when they just "think" the answer in text. The analysis tool fixes that by giving Claude a real execution loop: write code, run it, read the result, fix it if wrong, repeat. Below is a practical walkthrough of how to use it, what it's good for, and where its limits are.
Where to Find the Analysis Tool
The analysis tool is available in the claude.ai web app (and mobile app) on paid and free tiers, tied to Claude models that support it (Claude 3.5 Sonnet and newer). You don't need to manually enable anything — it activates automatically when your prompt involves something Claude decides needs computation, like analyzing a spreadsheet, doing statistics, or transforming structured data.
You'll know it's running because the chat shows an expandable "Analysis" block with the JavaScript code Claude wrote and its output, sitting above the final written answer.
Step-by-Step: Using the Analysis Tool
1. Upload or paste your data. Drag a CSV, XLSX, or JSON file into the chat, or paste a data table directly into the prompt box.
2. Ask a specific question. Vague prompts get vague answers. Compare:
- Weak: "Tell me about this data."
- Strong: "Calculate the month-over-month growth rate for each product category and flag any category with two consecutive months of decline."
3. Let Claude write and run the code. Claude generates JavaScript, executes it against your uploaded data, and reads the actual output before answering. You can expand the analysis block to inspect the code it ran.
4. Review and iterate. If the result looks off, say so directly: "That total doesn't match column D, recheck your filter logic." Claude will re-run the analysis rather than just apologizing in text.
5. Ask for visualizations if needed. The analysis tool can also generate chart data that Claude renders as visual output (bar charts, line charts, scatter plots) directly in the conversation.
What the Analysis Tool Is Good At
- Exact arithmetic on real data — sums, averages, percentages, growth rates, pivots
- Data cleaning — deduplication, type coercion, filtering malformed rows
- Statistical operations — correlations, standard deviation, regression basics
- Format conversion — CSV to JSON, restructuring nested objects, flattening tables
- Multi-step logic — anything that would be error-prone if reasoned through purely in text
What It Can't Do
- No internet access. The sandbox is isolated — it can't fetch URLs, call external APIs, or pull live data.
- No persistent state across separate chats. Each conversation's sandbox is fresh; nothing carries over unless you re-upload it.
- File size and row limits. Very large datasets (hundreds of thousands of rows) may get truncated or slow the analysis down — pre-filter large files when possible.
- Not a general code sandbox. It's scoped to JavaScript for computation, not a full dev environment for running arbitrary programs.
Getting Analysis-Tool-Style Capability via API
The claude.ai analysis tool itself is a consumer product feature — it's not something you call directly in your own application. If you're building a product that needs Claude to run code, verify calculations, or process uploaded data programmatically, you need API access with tool-calling support, which is where SubToAPI comes in.
SubToAPI turns your existing Claude access into a standard HTTPS API: you get an application key (sub_live_...), send requests to https://api.subtoapi.app/v1/messages, and build your own analysis workflow — including tool use for code execution patterns — with full streaming and usage metadata. A minimal request looks like:
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Given this CSV data, calculate monthly growth rate: ..."}
]
}'
For workflows where Claude needs to call a code-execution function you define and return the result back into the conversation, check the tool use docs — you define the tool schema, Claude requests a call, your backend executes it (a JS sandbox, a Python service, whatever fits your stack), and you send the result back as part of the message history, same pattern as the messages endpoint uses for any tool. Streaming partial output while the tool runs is covered in the streaming docs. If you're new to the API, the quickstart walks through getting your first key from signup and pricing details are on the pricing page.
Practical Tips for Better Results
- Be explicit about the calculation method — "use the trapezoidal rule" beats "estimate the area"
- Ask Claude to show its work if you need to audit the logic, not just the final number
- Break large analyses into steps rather than one giant multi-part question — this reduces truncation and makes errors easier to catch
- Re-upload cleaned data if the first pass reveals formatting issues, rather than asking Claude to patch around bad input repeatedly
FAQ
Do I need a paid Claude plan to use the analysis tool? No — it's available on the free tier of claude.ai, though usage limits and model access vary by plan.
Can the analysis tool access the internet or external databases? No. It runs in an isolated JavaScript sandbox with no network access, so it only works with data you provide directly in the chat.
Is the analysis tool the same as API tool use? No. The analysis tool is a claude.ai feature for interactive data work. If you want similar code-execution behavior in your own application via API, you build it using tool calling — see the tool use docs for the pattern.