Getting Started with Python in Excel
Microsoft’s Python in Excel runs pandas, matplotlib and seaborn inside a cell through the PY function, with the computation on Microsoft’s cloud rather than your machine. It is good for analysis next to your data, but the cloud dependency, the fixed set of libraries and the Microsoft 365 requirement are real limits.
Update (November 2026): I recorded this during the beta; Python in Excel is now generally available for Microsoft 365 Business and Enterprise users on Windows, Mac (version 16.96 or later) and the web, and Family and Personal plans get it as a preview.
Your first Python formula
A Python cell starts from the Formulas tab. Click Insert Python in the Python section and the formula bar switches to Python. Type df =, select your Excel table or a normal cell range, and press Ctrl+Enter to run it.
Excel inserts an xl() reference for the selection and loads it as a pandas DataFrame, with the header row recognized. The cell shows a DataFrame object, and a click on its icon opens a preview. From there you can use the usual pandas functions on it.

A Python cell can return a Python object or an Excel value. df.describe() returns another DataFrame. Switch the output to Excel Value in the drop-down next to the formula bar and the summary statistics spill into the sheet.

The same works for df.corr(). Charts come back as image objects: a matplotlib scatter plot or a seaborn pair plot sits in a cell, and you can show it larger on the sheet.

A real sales analysis
The second example is a transaction table of sales in five stores in Japan, with customer type, product line, unit price, quantity, date, time, payment method and sales amount.

I load the table into a DataFrame called data and convert the date and time columns to datetime values. Then I group by product line to find the top sellers. The aggregation method is not hard-coded: xl("CALC_METHOD") reads it from a cell with a drop-down, so switching that cell from sum to mean updates every calculation and chart that uses it.
top_5_products = (data.groupby('Product Line')
.agg({'Sales Amount': xl("CALC_METHOD")})
.sort_values('Sales Amount', ascending=False)
.head(5)
.reset_index())


Sales by weekday follow the same pattern. assign adds a weekday column from the date, then I group, aggregate and reset the index for the chart.

Sales by hour show that most customers shop after work, which is useful for staffing. A month-over-month growth rate goes into a combined bar and line chart.

Finally, a pivot table of sales by product line and month feeds a seaborn heatmap, which makes seasonal peaks per product line easy to spot.

My verdict
Python in Excel is a useful extra tool for analysis, especially where pandas makes a step simpler than formulas, such as date and time calculations. For cleaning and aggregating, Power Query is often just as good and needs no code.
In my tests, the more Python cells a workbook had, the slower it got. For exploratory data analysis I still prefer a Jupyter notebook. My add-in MyToolBelt creates a notebook that reads the selected Excel data into a pandas DataFrame.

Limitations
The main limits come from running in Microsoft’s cloud. Your code and the data it references are processed there, not on your PC, and it needs a qualifying Microsoft 365 plan.
- Fixed libraries: only the packages Microsoft provides through Anaconda are available. You cannot pip install others.
- No external files or web requests: Python cells only see data passed in with
xl(). Load outside data with Power Query first. - Static charts: plots come back as images. Interactive libraries such as Plotly do not give you interactive charts in the cell.
- Speed: many Python cells make recalculation slow.
If you need other chart libraries in a workbook, xlwings can insert Python charts into Excel as pictures. If the cloud and the fixed packages are a problem, take a look at xlwings Lite, which runs Python locally inside Excel and can install extra packages. With it you can also build interactive charts from your Excel data with pyecharts that open in any browser. For the older desktop route with a local Python installation, see how I run Python in an open Excel workbook with xlwings. To learn Python as an Excel user from scratch, my Excel Automation Course teaches it with xlwings Lite.
Resources
- Python in Excel availability (which plans and platforms have it)
- Anaconda: Python in Excel
