py-xlsx icon indicating copy to clipboard operation
py-xlsx copied to clipboard

Work around malformed inlineStr data

Open ErwinJunge opened this issue 10 years ago • 2 comments

When reading a rather complex excel file (that I can't share due to NDA) I ran into an IndexError on an inlineStr node. I have no idea what that means exactly, thus the current work around.

Do you have any comments on whether this is a good idea?

ErwinJunge avatar Feb 16 '15 11:02 ErwinJunge

Would it be possible to rewrite this to do checks rather than rely on exception handling?

staale avatar Feb 16 '15 11:02 staale

Ofcourse we could do if len(columnNode) > 0 and len(columnNode[0]) > 0, but that would just make the code harder to read. This seems to me like we're dealing with malformed data and thus an exceptional situation, for which exception handling is the right way to go.

My original question still stands however. Is this a good idea in the first place? I.e. is this a malformed xlsx document or should we perhaps be looking at a different location in the xml? I don't have in-depth knowledge of the used xml format, so I don't know which is the case here.

ErwinJunge avatar Feb 16 '15 13:02 ErwinJunge