Python in Excel is currently in preview and is subject to change based on feedback. To use this feature, join the Microsoft 365 Insider Program and choose the Beta Channel Insider level.
Python in Excel is gradually rolling out to Excel for Windows customers using the Beta Channel. At this time, the feature is not available on other platforms.
If you encounter any issues with Python in Excel, please report them by selecting Help > Feedback in Excel.
Review the following requirements list before troubleshooting errors.
The feature is not available on the following platforms.
Excel for Mac
Excel on the web
Excel for iPad
Excel for iPhone
Excel for Android
On unsupported platforms, workbooks containing Python can be viewed but Python cells display an error when recalculated. To use this feature in Excel for Windows, join the Microsoft 365 Insider Program and choose the Beta Channel Insider level.
Note: Python in Excel requires Microsoft Edge WebView2.
Python in Excel requires Internet access because calculations run on remote servers in the Microsoft Cloud. The calculations are not run by your local Excel application.
Troubleshoot Excel errors
Python in Excel calculations can return standard Excel errors to Python cells, such as #PYTHON!, #BUSY!, and #CONNECT!.
Access the error message
To learn more about how an Excel error applies to your Python formula, open the error message. To open the error message, select the error symbol next to the cell and then select Show Error Message from the menu. The following screenshot shows the error menu containing Show Error Message.
Next, Excel displays a Python Error Message with additional information. In this case, the #PYTHON! error is the result of invalid Python syntax on line 1 in the Python formula.
Note: The diagnostics task pane automatically opens in Excel if the #PYTHON! error is returned. See the #PYTHON! error information in the following section to learn more about the diagnostics task pane.
Python in Excel must be enabled in a workbook for Python formulas to calculate. If you see the #BLOCKED! error, ensure that you have access to Microsoft 365 connected services.
The #BUSY! error indicates that Python calculations are running in the Microsoft Cloud. If the #BUSY! error displays for longer than 60 seconds, try resetting the Python runtime. From the Formulas tab, in the Python group select Reset runtime. Or use the keyboard shortcut Ctrl+Alt+Shift+F9.
Python in Excel calculations can process up to 100 MB of data at a time. Attempting to run a calculation with more than 100 MB of data returns the #CALC! error. Try using a smaller dataset.
Try refreshing the connection with the Microsoft Cloud by resetting the Python runtime. From the Formulas tab, in the Python group select Reset runtime. Or use the keyboard shortcut Ctrl+Alt+Shift+F9.
The #PYTHON! error likely indicates a Python syntax error. The diagnostics task pane automatically opens if the #PYTHON! error is returned. Check the diagnostics task pane to see details about the error.
View the diagnostics task pane
The diagnostics task pane displays in the Excel UI, to the right side of the grid. Use the diagnostics task pane to continuously view standard outputs, standard errors, and interpreter errors with your Python in Excel calculations. To manually open the diagnostics task pane, go to a Python cell in the worksheet, open the context menu (right-click or Ctrl+click on the cell) and select Diagnostics for this cell.
The following screenshot shows the diagnostics task pane displaying one error: a syntax error for a Python formula in cell C1.
The #SPILL! error likely indicates that a cell in the Python output range already contains data. This could be the result of returning a Python object as Excel values. The Excel values may spill across multiple cells. See How to correct a #SPILL! error for resolution strategies.
The #UNKNOWN! error in a Python cell likely indicates that your version of Excel doesn’t support Python in Excel. To learn more, see the Feature requirements section earlier in this article.