Code Execution and File Creation in Claude: Calculated Numbers and a Real Excel File
Switch on code execution and file creation, upload a year of sales against target, and watch Claude calculate the variance, build an Excel file with a chart and name the three biggest shortfalls. Then check the result against the known answers.
What you will learn
- Turn on code execution and file creation in claude.ai settings
- See the difference between a number Claude estimates and one it calculates
- Get a formatted Excel file with a chart from twelve months of sales data
- Check Claude's result against answers you already know
Before you start
- A claude.ai account
- The Capability Layer: Skills, Code Execution and Memory
Ask a plain chat for a sum and it can sound very sure about a number it just guessed. Turn on code execution and file creation and Claude stops estimating. It writes real code, runs it in a sandbox, and hands you a checked number and a file you can download.
One switch turns Claude from a writer into a calculator. In this lesson you'll flip it, run a real sales analysis, and check the answer yourself.
It is also the switch that the next feature needs. Skills that produce files do nothing without it, which is why this comes before adding and using Skills.
Turn it on
- Open claude.ai, then Settings, then Capabilities. On a Team or Enterprise account the lecture shows it under Organization settings, then Skills.
- Switch on Code execution and file creation.
That path is how the screens looked at the time of the lecture. Menus move, so if you can't find it, look for the same toggle name.
See the difference: before and after
The best way to feel what this switch does is to run the same prompt twice. First, in a throwaway chat with the switch off, paste the data and ask for a formatted Excel file with a chart. You get a text table only. No file, no chart.
Then switch it on and run the exact same prompt.
The data
The lecture uses a small file, Sample-Sales-Data.xlsx, with twelve months of actual sales against target. Uploading a real file is the better test, because it uses file upload and code execution together, just like a file you have on your own machine. You can also paste the values.
The file holds raw data only, no formulas. Claude has to do the maths, which is the whole point.
| Month | Actual Sales | Target |
|---|---|---|
| Jan | 42500 | 40000 |
| Feb | 38200 | 40000 |
| Mar | 51300 | 45000 |
| Apr | 44100 | 45000 |
| May | 47800 | 45000 |
| Jun | 39600 | 45000 |
| Jul | 52400 | 50000 |
| Aug | 48900 | 50000 |
| Sep | 55200 | 50000 |
| Oct | 49700 | 52000 |
| Nov | 61300 | 55000 |
| Dec | 58100 | 55000 |
The prompt
Upload the file and type:
Here is our monthly sales vs target for last year. Work out the variance and percentage variance for each month, the full-year totals, and which months missed target. Then give me a formatted Excel file with a chart comparing actual vs target, and tell me the three biggest shortfalls.
What to look for
- The code panel appears. Claude writes and runs real code in a sandbox. It is calculating these numbers, not estimating them.
- The computed table: variance and percentage variance for every month.
- A real .xlsx download. This is the file creation half of the switch. Open it.
- The chart comparing actual against target.
- The answer to your question: the three biggest shortfalls.
Check it against the known answers
You don't have to take the result on trust. These are the right answers for this data, so compare your run against them:
| Check | Right answer |
|---|---|
| Total actual | $589,100 |
| Total target | $572,000 |
| Variance | +$17,100 (3.0% over) |
| Months that missed target | 5: Feb, Apr, Jun, Aug, Oct |
| Three biggest shortfalls | Jun (−5,400), Oct (−2,300), Feb (−1,800) |
If anything on your screen differs, you've spotted a problem straight away. That is the habit to build: know roughly what right looks like before you read the answer.
A shorter example
If you want something quicker, time arithmetic is fiddly enough to show the working:
I spent 3 hours 47 minutes, 2 hours 18 minutes and 4 hours 9 minutes on three tasks this week. Give me the total, the average, and what percentage of a 40-hour week each task took.
This one produces no file to download, so it shows only half of what the switch does.
Why it matters
A computed number can be checked. A generated number is only a claim. That's why output from code execution sits at the top of the trust ladder, and why you'll come back to it in fact-checking Claude's answers.
Reach for this setting for anything involving numbers, data transformation, charts, or a real file you can download.
Common mistakes
- Leaving the switch off and trusting a confident number from plain chat.
- Uploading a file that already holds formulas, so you never see whether Claude can do the maths.
- Not opening the downloaded file. A file you haven't opened is a claim. A file you have opened is proof.
- Reading the result cold. Know the totals first, then compare.
Quick recap
| Step | What to do |
|---|---|
| Turn on | Settings, Capabilities, Code execution and file creation |
| Upload | Raw data, no formulas |
| Ask | Variance, totals, misses, an Excel file with a chart |
| Look for | Code panel, table, .xlsx, chart, answer |
| Check | $589,100 vs $572,000, 5 misses, Jun the worst |
StudyEasy AI Community
Learn AI engineering, share what you build, and connect with other learners.
Free resources: lesson files, notebooks and code
Ask questions and join engineering discussions
Meet real people learning and building with AI
Related course on Udemy
Claude Certified Associate (CCAO-F): Complete Exam Prep
Every domain of the Claude Certified Associate exam, explained.View on Udemy ↗: Claude Certified Associate (CCAO-F): Complete Exam Prep (paid course, opens in a new tab)Related posts
Claude.ai Interface Tour: Every Control You Need on One Screen
Sign in to claude.ai and learn the one screen you'll use for everything: the chat box, the model selector, the sidebar with chats and Projects, the attach and tools row, the Artifacts panel and Settings.
The AI Fluency Model: Delegation, Description, Discernment and Diligence
Most people pick up AI skills in a random order. The AI Fluency Model builds them in sequence: Delegation (what to hand off), Description (asking well), Discernment (judging the output) and Diligence (using it responsibly).
Working With Claude: Pick the Surface, Match the Model, Keep the Context Clear
Three questions every time you use Claude: where do I use it, which model fits, and how do I keep it sharp? Learn the five surfaces, the four model tiers and the context window, with three habits that keep the board clear.
Claude's Four Entry Points: Choose Chat, Projects, Artifacts or Research Before You Type
Before you type, pick the room: Chat for a quick word, Projects for recurring work with your files, Artifacts for a deliverable you'll edit and keep, Research for a deep, cited dig. A decision guide with links to each deep dive.
