0

When trying to execute the below code

import time

app=xw.App(visible=False)
wb=app.books.open( r"c:\test\x.xlsm")
ws=wb.sheets['Sheet1']
wb.save()
wb.close()
app.kill()

In visual studio (version 17.3.3 (2022) ) ,I'm getting the below error.

Stack trace:
 >  File "C:\Users\user1\AppData\Local\Temp\gen_py\3.10\00020813-0000-0000-C000-000000000046x0x1x9.py", line 41316, in __call__ (Current frame)

 >    ret = self._oleobj_.InvokeTypes(0, LCID, 2, (13, 0), ((12, 1),),Index

Can anyone please let me know how to resolve this.

I have tried reinstalling all the python modules ,but nothing seems to be working . I tried to uncheck the uncaught and raised exception breakpoint, But I'm unable to find those check box in this VS version.It is not present in Debug tab as well.

Myna
  • 15
  • 4
  • 1
    Have you seen https://stackoverflow.com/questions/36064723/pywintypes-com-error-2147352567-exception-occurred-0-none-none-none The accepted answer is from a developer of Xlwings I believe. Should probably be the issue. – Timothy G. Sep 15 '22 at 17:12
  • Yes,But here I'm trying to open the existing excel sheet,but still it is throwing same error. – Myna Sep 21 '22 at 06:23

1 Answers1

1

For what its worth, I had a similar error writing to a sheet with xlwings, using .range('named range').value = pd.DataFrame.

I found it crashed when attempting to write a column with an = in. It appears there are issues with other unicode characters (as shown in comments here https://stackoverflow.com/a/36080159/18253502).

Not sure if this is your problem, but hope it helps someone as I found little evidence of this issue elsewhere.

tim-hy
  • 43
  • 8