D.prd
D.prd

Reputation: 675

Exception when writing large cell value(formula) to excel

I am using xlwings to update large formulae in excel. I am not sure how to disable interacting mode with xlwings and doesn't look like I am impacted by this: pywin32 and excel. Exception when writing large quantities of data

How can I debug the follow exception I am getting when I try to write a huge formula of the form ="ABC" + "DEF" + "XYZ" from a pandas dataframe to excel sheet? How to get to the root cause?

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146827284), None)

Thanks.

Upvotes: 1

Views: 668

Answers (2)

D.prd
D.prd

Reputation: 675

I eventually found a formatting issue with the formula being written. This issue is resolved for now but would be helpful for everyone if the error could provide details. 'Exception occurred' wasn't of much help. Thanks.

Upvotes: 0

Felix Zumstein
Felix Zumstein

Reputation: 7070

You can get more information about the error like this:

>>> import win32api
>>> win32api.FormatMessage(-2146827284)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pywintypes.error: (317, 'FormatMessageW', 'The system cannot find message text for message number 0x%1 in the message file for %2.')

After googling the error message it seems that it could be a 32 vs 64bit conflict.

I would try with a fresh installation as xlwings should work no matter what bitness combination you have between Excel/Windows and Python.

Upvotes: 2

Related Questions