Please note javascript is required for full website functionality.


Python Editor from Excel Labs

19 September 2023

Hot on the tails of Python in Excel, the Python Editor is a new addition to Excel Labs that allows you to write and edit Python formulae in Excel using a dedicated code editor with similar capabilities as those available in Python notebook environments.  It should be noted that this is an experimental release to get early feedback for Microsoft, so it might all change.  The Python Editor is designed to complement the Python in Excel experience with an editing surface optimised for more complex and longer Python code snippets.

The Python Editor offers several benefits when writing and editing Python formulae in Excel.


View the flow of code execution with results

The Python Editor shows Python cells in execution order in addition to the output of each cell’s code, which can help you debug and understand your code.  This is useful because Python cells within the Excel grid execute in row major order.  This means that the cell calculations run across a row (from column A to column XFD), and then across each following row down the worksheet.

Built for longer sections of code

The Python Editor provides a new way to create and edit your Python code, offering more flexibility when working with longer scripts.

Standard Visual Studio code features

The Python Editor uses some of the same components that power Visual Studio Code and supports many of the features that Visual Studio Code offers for Python development, such as IntelliSense, formatting, code completion and syntax highlighting.

Flexibility for intermittent coding workflows

The Python Editor allows you to write some code, click elsewhere in the application, and not commit the code to Excel until you are happy with it.  This gives you more flexibility and control over when and how you apply your code to your workbook.  Additionally, when in manual recalculation mode, editing and committing from the Editor will calculate just that cell (like a notebook) providing a faster feedback loop.

The Python Editor is intended to enhance your productivity and creativity with Python in Excel.  You can use it to write and edit Python formulae that perform complex calculations, manipulate data, create charts, and more.  You can also switch between the task pane editor, the cell editor and the Formula bar, depending upon your needs and preferences.


How to get the Python Editor

If you already have the Excel Labs add-in, you can update it to get the latest version that includes the Python Editor.  If you don't have the Excel Labs add-in, you can install it from the Add-ins Store.  To do this, go to the Insert tab, click on ‘Get Add-ins’, and then search for Excel Labs.  Click on ‘Add’ to install the add-in.

Once you have the Excel Labs add-in, you need to launch the Python Editor.  This may be done by:

  • hitting the menu at the top right and selecting ‘Feature Gallery’
  • selecting the ‘Python Editor experiment’.

Anyone may get Excel Labs.  However, you need to have access to Python in Excel to make use of the Python Editor.