A Snake Between the Sheets

Run Python Directly in Excel — Huge News

Miki Tebeka
The Pragmatic Programmers
2 min readOct 30, 2023

--

https://pragprog.com/newsletter/
https://pragprog.com/newsletter/

Spreadsheets are amazing! They allow non-programmers to create complex computations. People use it in their personal lives for things like creating a budget for the next family vacation or tracking stock investments.

Professionals also use spreadsheets regularly. Managers use them for sophisticated back of the envelope calculations and even to track team progress. I’m sure you use spreadsheets in your work too.

At times, you’ll reach the limitation of spreadsheets. You might need a custom regression or need to fetch data from an external API. The usual solution is to export the spreadsheet to CSV and then continue the computation elsewhere. Elsewhere being Python, which is the language for data analytics and data science.

The Python program can emit CSV at the end of the run, and then you can import it to a spreadsheet and run more calculations or generate some nice charts.

Recently, Microsoft announced that you can run Python directly from Excel. This addition means you can skip the import/export steps and do everything inside Excel. You’ll find it takes less time to complete your tasks and the quick feedback cycle will make the work more fun.

What’s even better? It’s not only Python, but the Anaconda Python distribution. This distribution is full of scientific tools such as the Pandas data analysis and manipulation library, the scikit-learn machine learning library, and visualization tools such as Matplotlib and seaborn, which will draw charts directly in Excel.

The data-driven future looks very promising as more people take their first programming steps inside Excel with Python.

--

--