Applies ToExcel for Microsoft 365

Python in Excel is now available to Enterprise and Business users running the Current Channel on Windows, starting with Version 2408 (Build 17928.20114), and Monthly Enterprise Channel on Windows, starting with Version 2408 (Build 17928.20216).​​​​​​​ It’s available in preview for Family and Personal users running the Current Channel on Windows starting with Version 2405 (Build 17628.20164). Python in Excel is available in preview for Education users running the Current Channel (Preview) through the Microsoft 365 Insider Program. It's not currently available for the Semi-Annual Enterprise Channel.

It's rolling out to Excel for Windows first, and then to other platforms at a later date.  For more availability information, see Python in Excel availability.

If you encounter any concerns with Python in Excel, please report them by selecting Help > Feedback in Excel.

The Python in Excel code editor is a task pane that provides an editing space for large code blocks when authoring Python in Excel formulas. It shows all the Python code in your workbook, listed by worksheet and cell number. The code editor also includes features like IntelliSense and text colorization to support editing large blocks of code.

Note: The Python in Excel code editor is currently available to Enterprise and Business users running the Current Channel on Windows, starting with Version 2410 (Build 18129.20116). It's available in preview for Family, Personal, and Education users through the Microsoft 365 Insider Program.

Shows the open task pane and multiple Python cells in the task pane.

To open the Python in Excel code editor, select a Python cell in your workbook and then go to Formulas > Editor. This opens the task pane and displays all the Python cells in your workbook.

Editing options in the task pane

Within the code editor task pane, you can edit each Python cell in your workbook. Use the menu above each cell in the task pane to save and run a Python cell, switch between output types (from Python object to Excel value), undo changes, or expand a cell to a larger code editing area.

The menu options for each Python in Excel code editor cell.

Filter within the task pane

Use the filter at the top of the task pane to narrow the content displayed in your code editor task pane, such as only displaying Python cells on the current worksheet or only displaying Python errors.

Use the filter at the top of the task pane to narrow your content.

Display Python output in the task pane

The output of each Python cell in the code editor task pane is displayed in your Excel workbook. You can also see the output in the code editor task pane by expanding the output type at the bottom of each code block. 

Expand the output to see images and other output data.

Related articles

Python Editor - Now Available

Graduating the Python Editor to Insiders: Beta

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.