Regression 2.2.0 failed to read a xslx file that 2.1.5 had no problem with.

Issue #440 resolved
C. W.
created an issue

Hi all

IndexError was thrown when reading the attached file. The easy to reproduce the problem is to open it using openpyxl 2.2.0.

>>> from openpyxl import load_workbook
>>> doc=load_workbook('test8.xlsx', data_only=True)
....
packages/openpyxl/reader/style.py", line 160, in _parse_xfs
    format_code = self.number_formats[numFmtId-165]
IndexError: list index out of range

And here is more details of the problem:

https://travis-ci.org/chfw/pyexcel-xlsx/builds/51672795

Cheers

Comments (4)

  1. CharlieC

    Thanks for the report. The problem is almost certainly due to this format: <x:numFmt numFmtId="43" formatCode=" * #,##0.00 ; * -#,##0.00 ; * &quot;-&quot;?? ; @ " />

    This is sort of a builtin format but not all builtin formats are created equal as some of them are locale specific. It's not in the list of ones that will always be available so we treat it as a custom one but these must have indices above 165. Looks like we'll have to add some handling for builtins that we don't know about.

  2. CharlieC

    FWIW it looks like this is a customised form of a builtin format that we do have: '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)' I've just checked in a change that resolves this.

  3. Log in to comment