Formatted workbook doesn't load

Issue #544 resolved
Nicolas May created an issue

Hi there,

When I try to load a workbook with formatting that is generated by a database, I get the following error:

Traceback (most recent call last): File "xlsxParser.py", line 5, in <module> wb = load_workbook('/path/to/spreadsheets/foo.xlsx') File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/openpyxl/reader/excel.py", line 202, in load_workbook parsed_styles = read_style_table(archive) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/openpyxl/reader/style.py", line 181, in read_style_table p.parse() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/openpyxl/reader/style.py", line 53, in parse self.parse_named_styles() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/openpyxl/reader/style.py", line 109, in parse_named_styles names = self._parse_style_names() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/openpyxl/reader/style.py", line 128, in _parse_style_names for _name in node: TypeError: 'NoneType' object is not iterable

But, if I clear the formatting of the .xlsx doc in Excel, I have no problems loading the workbook. Is this a known bug? I searched the issues, but couldn't find anything similar.

Ideally, I'd like to be able to use openpyxl without having to first use Excel to clear the formatting.

Thanks.

Comments (6)

  1. CharlieC

    Thanks for the report. It's a new issue because limited support was introduced in 2.3. Can you provide a sample file and let us know what application or library created the file?

    It's probably easy to fix but it would be good to have a test file.

  2. CharlieC

    Thanks, I can confirm that the bug has been fixed. You'll need to work with a checkout of 2.3 branch until we release 2.3.1

  3. Log in to comment