Introducing the Python Editor from Excel Labs
Published Sep 18 2023 09:00 AM 38.5K Views
Microsoft

The Python Editor is a new addition to Excel Labs that allows you to write and edit Python formulas in Excel using a dedicated code editor with similar capabilities as those available in Python notebook environments. This is an experimental release to get early feedback, so we develop Excel to be the most useful for you. The Python Editor is designed to complement the Python in Excel experience with an editing surface optimized for more complex and longer Python code snippets.

excellabspythoneditorbloghero.png

Benefits

The Python Editor offers several benefits when writing and editing Python formulas 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.

screen_1_long.png

 

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.

screen_3.png

 

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.

extractandformatdates.gif

 

Flexibility for intermittent coding workflows

The Python Editor allows you to write some code, click elsewhere in the app, 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 recalc mode, editing and committing from the Editor will calculate just that cell (like a notebook) providing a faster feedback loop.

weatherforecast.gif

 

The Python Editor is a great way to enhance your productivity and creativity with Python in Excel. You can use it to write and edit Python formulas 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 on your needs and preferences.

 

Here is how you can try it out today!

 

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 can be done by

  1. Hitting the menu at the top right and selecting Feature Gallery
  2. Selecting the Python Editor experiment

instructions.png

 

Access Requirements

Anyone can get Excel Labs today, however, you need to have access to Python in Excel to make use of the Python Editor. For more information on how to get access to Python in Excel, please check out our accompanying post on Python in Excel

 

Join the Python in Excel Reddit AMA on Sept 28th!

Tune into our Ask Me Anything session on Reddit, r/excel, for questions, answers and more information on Python in Excel.

 

We want your feedback!

Excel and Python users can give feedback directly within the application (go to Help > Feedback), suggest improvements on our Feedback portal, or engage with our team on GitHub.

 

Other resources:

Introduction to Python in Excel

 

Getting started with Python in Excel

 

Learn more about Anaconda

11 Comments
Version history
Last update:
‎Sep 15 2023 04:35 PM
Updated by: