Microsoft Excel spreadsheet program on display screen of a laptop.
Image: wachiwit/Adobe Stock

Python in Excel is now available on a rolling basis for Microsoft 365 Insiders program beta channel members, the Redmond tech giant announced on Tuesday. This change allows those Excel users to execute Python analytics within their worksheets. It pairs Python’s data analysis and visualization libraries with Excel’s features, plus the ability to call Python analytics from Anaconda’s enterprise-grade Python distribution hub.

More information about when Python in Excel will be generally available is expected soon.

What is Python in Excel?

With Python in Excel, users will be able to type Python code directly into an Excel cell. The Python calculations will run on Microsoft’s cloud servers and be delivered back to the Excel sheet.

Python plots and libraries will be capable of manipulating and exploring data in Excel. From there, users can apply Excel’s formulas, charts and PivotTables to the data they have calculated in Python (Figure A).

Figure A

A screenshot of Python calculation in a Microsoft Excel cell.
A demonstration of Python calculations typed into an Excel cell. Image: Microsoft

With its Anaconda Distribution for Python running in Azure, Python in Excel will call common Python libraries, including pandas (data manipulation), statsmodels (advanced statistical modeling), and Matplotlib and seaborn (data visualization).

“Python’s integration in Excel marks a significant leap forward for data science, combining the popularity of both tools to address a long-standing gap between the capabilities of Python for data science and Excel’s familiar interface,” Guido van Rossum, distinguished engineer at Microsoft and the creator of Python, told TechRepublic in an email.

“The ability to run Python in Excel simplifies McKinney’s reporting workflows,” said Greg Barnes, executive director of data and analytics at McKinney, in Microsoft’s blog post about this news. “We used to manipulate data structures, filter, and aggregate data in a Jupyter Notebook and build visuals in Excel. Now we can manage the entire workflow in Excel.”

Teams and Outlook users will be able to view Python calculations from Excel

Microsoft Teams and Microsoft Outlook will also have newfound Python functionality; both can be used to share workbooks and Python analytics with Python in Excel. If you’re collaborating with a teammate who doesn’t have Python in Excel, they’ll still be able to see the analytics and comment on the data in Teams or Outlook.

SEE: Microsoft’s generative AI assistant, Copilot, may be the next big thing in the 365 suite. Here are all the applications it will touch. (TechRepublic)

Limitations of Python on Excel

There are limitations to running Python in Excel. Because the Python calculations are done in Microsoft’s cloud, any customizations a user may have made to their local Python installation will not be automatically applied to Python in Excel. Like most collaborative applications of this type, Python in Excel can only be used with an internet connection.

How to get Python in Excel

To sign up for the Public Preview, you need to join the Microsoft 365 Insiders program Beta Channel; you also need to be running Excel for Windows build 16818 or later. Some members may not see Python in Excel as an option yet; Microsoft stated this beta will be rolled out in waves.

Users with the Public Preview will be able to see Python in the Excel ribbon menu. Those users can bring external data into Python using Power Query and built-in Excel workflows.

While Python in Excel is in beta, members of the Insider community may expect to see fixes and tweaks to the following:

  • Enhanced editing features like autocomplete and syntax highlighting.
  • Default repairs.
  • Updated error behaviors.
  • Improved help menus and documentation.

Microsoft expects Python in Excel to be expanded to platforms beyond Excel for Windows, such as Excel for the Mac or for mobile devices, at a later time.

How to use Python in Excel

If you have the latest build of the Insider version of Excel installed, take the following steps to open Python in Excel:

  1. Open a blank workbook.
  2. Navigate to Formula in the ribbon menu.
  3. Choose Insert Python.
  4. Choose the Try button when a dialogue box appears.

There is an alternate way to open Python in Excel.

  1. Enter =PY into an Excel cell.
  2. Select PY from the function AutoComplete menu.
  3. Enable the preview using the dialogue box.

Subscribe to the Data Insider Newsletter

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more. Delivered Mondays and Thursdays

Subscribe to the Data Insider Newsletter

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more. Delivered Mondays and Thursdays