Excel Labs: error Saving Python code in cell

Copper Contributor

Hi everyone, I installed the Excel Labs add-in but when I try to save any Python code in a cell I get this error (in Italian): Save failed: The argument is not valid, is missing, or has an incorrect format.

 

I am attaching a screenshot:

error.png

 

Can anyone help me?

 

Thank You

 

Uccio

5 Replies

Hi @uccio991994,

Can you try running the code in a Python notebook or IDE to see if there are any errors?

If there are errors, then try to fix them and then try saving the code in Excel Labs again.

If there is no errors, than you can try this:

  • Make sure that you have the latest version of Excel Labs installed.
  • Try restarting Excel.
  • Try saving the workbook to a different location.
  • Try creating a new workbook and saving the code there.

If you're still having trouble, you can post your code here so we can try to analyse it.

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)

@LeonPavesic 

 

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)

@LeonPavesic 

 

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?

@UilianAlbino 

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)