Forum Discussion
Excel Labs: error Saving Python code in cell
Hi, thanks for the reply.
I've tried everything you recommended but the problem persists.
Even with a simple code like:
a = "Hello"
the problem arises.
Thank you
Hi uccio991994,
thanks for your update.
If you are still getting the error even with a simple code like "a = 'Hello'", then it is possible that there is a problem with your Excel installation or with your operating system.
To try to troubleshoot the problem, you can try the following:
- Repair Excel. To do this, go to the Control Panel and select Programs and Features. Find Excel in the list of programs and click on Change. In the Change dialog box, select Repair and click Continue.
- Reinstall Excel. If repairing Excel does not fix the problem, then you can try reinstalling Excel. To do this, go to the Control Panel and select Programs and Features. Find Excel in the list of programs and click on Uninstall. Once Excel has been uninstalled, you can download and reinstall Excel from the Microsoft website.
- Update your operating system. If you are using an older version of your operating system, then it is possible that there is a bug that is causing the problem. Try updating your operating system to the latest version to see if this fixes the problem.
- Make sure that you have the latest version of Python installed.
- Try running the Python code in a different Python environment, such as a Python notebook or IDE.
- Try saving the Excel workbook to a different location.
- Try creating a new Excel workbook and saving the Python code there.
- Try disabling any other Excel add-ins that you are using.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- UilianAlbinoOct 15, 2023Copper Contributor
I'm having the same trouble that uccio991994 is facing. I wrote the simple code below and the same error is showing up.
x=10 y=20 x+y
The interesting part is that with the office insider program, I'm able to run the 'PY' function and get the 'x+y' value. My operating system is up-to-date, and the office suite has been recently updated.
I suppose that having the latest python version is not always an option since library compatibility may be a problem in some cases.
With all the above in mind, do you have any other suggestions that may be causing the issue?
- SergeiBaklanOct 15, 2023Diamond Contributor
My guess that could be due to non-English version of Excel. There is nothing language dependant in the sample of the code, but Python editor is not localized. At least I can't reproduce on English version.
In any case that's better to communicate Excel team directly on GitHub Issues ยท microsoft/python-in-excel (github.com)