I've had a few people reach out saying they'd like more info on how to convert Excel to Python with Claude Code - something I've mentioned in some of my other blogs. Here's the step-by-step process I use to convert complex Excel financial models into Python modules, verified against the original spreadsheet.

Why do this?

The key benefit is the speed of trying many combinations of models. This is slow and painful to do in Excel, whereas it's trivial to run millions (or more) of variations in Python in seconds.

Also, it allows you to embed your Excel model in other applications (e.g. a web app dashboard, or internal tools). And Python has far more advanced capabilities than Excel, especially when it comes to machine learning.

Finally, once you have it in Python you can iterate with the coding agent itself to improve it. This is far easier to do in Python than getting an agent to understand a spaghetti mess of Excel formulae.

1. Audit your Excel sheet

Open a folder with Claude Code and drop a copy of your Excel file in.

Once that's done, open Claude Code in that with the plan mode enabled and ask something like this:

Please convert my complicated financial model in this folder (financial_model.xlsx) from Excel to a python module. It should work _identically_. Let's start with you doing a full audit of the sheet and all workbooks. Then come up with a plan to implement this and verify outputs against the Excel model. Use multiple subagents if helpful

I'd strongly recommend using the strongest model you can for this - at the time of writing this was Opus 4.6 or Codex 5.3-xhigh.

Claude Code auditing an Excel financial model in plan mode

2. Confirm the plan

Once you've got a plan, carefully read it and make sure it sounds reasonable - it should have understood the intent and what each sheet/part of your Excel workbook. It's far better to argue with it here than further down the line. Also, don't be scared to ask it to explain its understanding of parts of it if you're not sure if it's really understood.

It may suggest multiple phases if it's very complicated - that's fine to accept.

3. Implement

Once you've done this - let it implement it. This will take a while depending on your model. Again, don't be scared to interrupt it if you think it's going off track from some of the logs that it comes back with - or get it to explain further. But in my experience this part has been fairly automatic even on very large Excel files.

4. Iterate

Once the implementation is done, ask if it has anything to finish. On complex Excel files it often will leave some parts out because it's too complicated - make sure it's finished it all off. Once you've confirmed with the agent it thinks it is finished, ask it to run the model for you with various inputs and sanity check this against your Excel.

You may find small rounding errors (this may or may not be a problem) due to Python's numeric formats often being marginally different to Excel. In my experience this hasn't caused anything major but I could see things getting out if you have a very recursive model which requires very high precision. I'm sure this can be resolved by iterating with the model to emulate Excel's numeric precision more closely if needed. In my experience though, if you follow the steps here and ensure it's validating against the real Excel file, the output is usually perfect. If anything, it may find issues with your actual Excel formulae!

5. Run experiments with the model

The most powerful bit as I alluded to in the intro is to run many scenarios with the model's help.

For example, ask the agent to pull GDP/inflation trend figures from the internet, then feed it into the model to see the impact on your assumptions under various macroeconomic situations.

Or, ask it to search through all your organisation's presentations in the past and input some of the assumptions that were made to see how they turned out.

Monte Carlo simulation results from the converted Python model

The sky is the limit - you can also have the agent make a plan to improve your model now it's in code. Ask it what weaknesses it thinks you have, what data sources could be connected, etc. For example, you could pull in PowerBI data automatically (or any other SQL datasource) to keep the model completely up to date without any copying and pasting into Excel.

You'll hopefully find that the agent can find loads of interesting 'flaws' in your model and be able to implement them very quickly.

Claude Code suggesting structural improvements to the financial model

Finally, you can also combine this with my making great looking reports approach to have the model write findings from your collaborative runs together into presentations for you to present to your wider team, in your corporate branding. Keep in mind it's trivial to get Claude to plot graphs and charts from the Python model too, with a far better level of precision than (I at least!) can get in Excel.

The whole process takes less than an hour even for very complex models. Once it's in Python, you'll wonder why you ever did scenario analysis by hand in Excel.

If you'd like help converting your own Excel models or want to talk about how this could work for your team, feel free to get in touch.