Unable to read "inline" values

Issue #121 resolved
epost created an issue

As far as I can tell, the code does not support reading data from cells if the "inlineStr" option is used in the underlying xml. For example, if the xml for the cell looks something like this:

<c r="C3" s="4" t="inlineStr"><is><t>4953.25</t></is></c>

...instead of this (which is more typical):

<c r="C3" s="4"><v>4953.25</v></c>

This may not be the most proper way to fix it, but I was able to patch this for myself (I'm using v1.5.6) by adding this if-statement to the fast_parse method in reader/worksheet.py (the first line is existing code, line 86 in v1.5.6, or line 106 in v.1.5.7):

{{{

!python

    value = element.findtext('{http://schemas.openxmlformats.org/spreadsheetml/2006/main}v')
    if value is None and element.get('t') == 'inlineStr':
        value = element.findtext('{http://schemas.openxmlformats.org/spreadsheetml/2006/main}is/{http://schemas.openxmlformats.org/spreadsheetml/2006/main}t')

}}}

Comments (6)

  1. CharlieC

    @vashek thanks for the test file. Getting the value shouldn't actually be too much of a problem. Inline strings can include formatting information which would be more of a challenge but that doesn't seem to be the case here.

  2. Log in to comment