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 2407 (Build 17830.20128), 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.

New to Python in Excel? Start with Introduction to Python in Excel and Get started with Python in Excel

Feature requirements

Review the following requirements list before troubleshooting errors.

Platform availability 

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

For additional availability information, see Python in Excel availability

Internet access 

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. 

Python in Excel add-on license

If you purchased the Python in Excel add-on license and are working on multiple computers, Excel may take 24 to 72 hours to update the license. Try updating your license manually by going to File > Account > Update License.

For more information about the the add-on license, see Python in Excel add-on licensing FAQ.

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.   An error in a Python in Excel cell, with the error menu open.

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.

Common errors

#BLOCKED!

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.

Note: Python in Excel isn't supported for Microsoft 365 subscriptions that are device-based (assigned to a device instead of to a user) or use shared computer activation (multiple users share the same computer and each user logs in with their own account). For more availability information, see Python in Excel availability.

For additional #BLOCKED! error cases related to Python in Excel, see How to correct a #BLOCKED! error: Python in Excel.

#BUSY!

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.

Purchase a Python in Excel add-on license or enable the Python in Excel preview for access to faster calculations with premium compute. To learn more, see What's included in your Microsoft 365 subscription.

#CALC!

Python in Excel doesn't support references to cells with volatile values, such as cells using the RAND function. Python formulas that reference cells with volatile values return the #CALC error.

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.

#CONNECT! 

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.

#PYTHON!

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 Python in Excel diagnostics task pane, showing a syntax error.

#SPILL!

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. 

#TIMEOUT!

The #TIMEOUT! error indicates that the Python formula exceeded the maximum allotted execution time.

Try running the formula again or resetting the Python runtime. From the Formulas tab, in the Python group select Reset runtime, or use the keyboard shortcut Ctrl+Alt+Shift+F9.

You can also adjust the Python timeout limit. Go to File > Options > Advanced > When calculating this workbook and set Python Formula Timeout as desired.

#UNKNOWN!

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. 

Related articles 

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.