theorchard / openpyxl

Other
54 stars 21 forks source link

bug: TypeError: _NamedCellStyle.__init__() got an unexpected keyword argument 'biltinId' #14

Open jgroc-de opened 1 year ago

jgroc-de commented 1 year ago

Hi,

when trying to open an excel (.xlsx) file, i got this error:

Traceback (most recent call last): File "main.py", line 15, in load_workbook(filename='old.xlsx') File "~/.local/lib/python3.10/site-packages/openpyxl/reader/excel.py", line 317, in load_workbook reader.read() File "~/.local/lib/python3.10/site-packages/openpyxl/reader/excel.py", line 281, in read apply_stylesheet(self.archive, self.wb) File "~/.local/lib/python3.10/site-packages/openpyxl/styles/stylesheet.py", line 198, in apply_stylesheet stylesheet = Stylesheet.from_tree(node) File "~/.local/lib/python3.10/site-packages/openpyxl/styles/stylesheet.py", line 103, in from_tree return super(Stylesheet, cls).from_tree(node) File "~/.local/lib/python3.10/site-packages/openpyxl/descriptors/serialisable.py", line 87, in from_tree obj = desc.expected_type.from_tree(el) File "~/.local/lib/python3.10/site-packages/openpyxl/descriptors/serialisable.py", line 87, in from_tree obj = desc.expected_type.from_tree(el) File "~/.local/lib/python3.10/site-packages/openpyxl/descriptors/serialisable.py", line 103, in from_tree return cls(**attrib) TypeError: _NamedCellStyle.init() got an unexpected keyword argument 'biltinId'

if i open this file with calc or microsoft excel and re-save it, this error disappears. i tried it with another python lib to open excel files and it works so i guess it is something for openpyxl.

Badfully, i am not sure i can give you an exemple file for testing purpose... Ask me if ever the stacktrace is not enough.

thx for the lib anyway.

jlaine commented 11 months ago

I got bitten by the same problem here, and examining the contents of the file, it looks as though builtinId was misspelled as biltinId in the xl/styles.xml document. Was the document you are trying to parse by any chance created by a company named Erival Ingénierie?

jgroc-de commented 11 months ago

nop, but it seems they use the same tools i was facing: windev…

jlaine commented 9 months ago

Do you have a way to get in touch with the windev developers to get them to fix this typo?