Following the recent news from Microsoft and Anaconda about their partnership to bring Python into Excel, they don’t seem to be slowing down. Just this month, the Excel team at Microsoft announced the introduction of an experimental code editor for Python. While it’s only available as an extension at the moment, the editor may eventually become an integral part of the popular spreadsheet software.
Today, you can enable the Python Editor by installing the Excel Labs add-in, which is a Microsoft Garage project that started earlier this year to collect user feedback about experimental features in Excel. Primarily, this add-in provides an advanced formula-editing interface featuring syntax highlighting, auto-completion, inline error reporting, and more. Now, it also comes with a dedicated Python editor:
Thanks to being built on top of the open-source Monaco Editor, which is also a core component of the familiar Visual Studio Code, the Python Editor can run in your web browser. That’s essential for the ability to use the editor in the cloud-based Microsoft 365 office suite.
Anyone who tried the Python and Excel integration released less than a month earlier will immediately appreciate several advantages that the new Python Editor delivers:
Linear execution flow: The editor was designed to mimic the experience of working with Jupyter Notebooks due to their immense popularity among the data science community. Python in Excel seems to mainly target data scientists, so this choice makes sense. Like a typical notebook, the Python Editor shows individual spreadsheet cells with Python source code organized as a sequence that follows the row-major calculation order of grid cells in Excel.
Centralized navigation: The editor gathers all the code snippets from all over the grid and shows them in one accessible place, making navigation through cells with Python source code more convenient. You can find your entire Python code in a sidebar on the right, which also helps you see the bigger picture.
Output preview: Each cell in the Python Editor contains the output from the corresponding code snippet, which can help speed up the debugging process. That said, the preview was unable to render some types of content, such as plots, at the time of writing.
Spacious workspace: Having additional space for code makes editing long and non-trivial Python fragments more straightforward than using the narrow formula bar or the standard grid cell.
Convenient editing: The Python Editor boasts advanced features typically found in full-blown code editors or IDEs, including syntax highlighting, auto-completion, code formatting, and others.
Whether you’ve enabled Python in Excel or not, you can install the Python Editor. Unfortunately, to take full advantage of the editor, you must also be eligible to use Python in Excel, which requires becoming a member of the Microsoft 365 Insider program’s Beta Channel. After signing up, you’ll join a waiting list, which might take some time to process, so be patient.