Cannot parse XLSX #445

Closed
opened 2016-07-25 20:56:16 +00:00 by Ramzec · 5 comments
Ramzec commented 2016-07-25 20:56:16 +00:00 (Migrated from github.com)

Hello.

I'm trying to parse a XLSX file, but the parser does not parse sheet's data. I see workbook, i see sheet's name, but 'sheets' field is empty.

I did a research and found that 'parse_ws_xml_data' generates exception:

 7490       /* 18.18.11 t ST_CellType */
 7491       switch(p.t) {
 7492         case 'n': p.v = parseFloat(p.v); break;
 7493         case 's':
 7494           sstr = strs[parseInt(p.v, 10)];                                                                                         
 7495           p.v = sstr.t;
 7496           p.r = sstr.r;
 7497           if(opts.cellHTML) p.h = sstr.h;
 7498           break;

exception on line 7495, because sstr is undefined, because 'p' contains only 't'.

I did a research of my file the cell (A1) that is causes exception has the following structure:

<row r="1" spans="1:9" customHeight="1" ht="35"><c r="A1" t="s"/><c r="B1" s="14" t="s"><v>0</v></c><c r="C1" s="1"/><c r="D1" s="1"/><c r="E1" s="1"/><c r="F1" s="1"/><c r="G1" s="1"/><c r="H1" s="1"/><c r="I1" s="1"/></row>

I tried to open the file by LibreOffice. Everything good. A1 cell does not contains anything.

I saved the opened file to other file. The new file was successfully parsed.

The first row in the new file does not have A1 cell.

<row collapsed="false" customFormat="false" customHeight="true" hidden="false" ht="35" outlineLevel="0" r="1"><c r="B1" s="1" t="s"><v>0</v></c><c r="C1" s="1"/><c r="D1" s="1"/><c r="E1" s="1"/><c r="F1" s="1"/><c r="G1" s="1"/><c r="H1" s="1"/><c r="I1" s="1"/></row>

How to be in this case ?

Thanks,

Hello. I'm trying to parse a XLSX file, but the parser does not parse sheet's data. I see workbook, i see sheet's name, but 'sheets' field is empty. I did a research and found that 'parse_ws_xml_data' generates exception: ``` 7490 /* 18.18.11 t ST_CellType */ 7491 switch(p.t) { 7492 case 'n': p.v = parseFloat(p.v); break; 7493 case 's': 7494 sstr = strs[parseInt(p.v, 10)]; 7495 p.v = sstr.t; 7496 p.r = sstr.r; 7497 if(opts.cellHTML) p.h = sstr.h; 7498 break; ``` exception on line 7495, because sstr is undefined, because 'p' contains only 't'. I did a research of my file the cell (A1) that is causes exception has the following structure: ``` <row r="1" spans="1:9" customHeight="1" ht="35"><c r="A1" t="s"/><c r="B1" s="14" t="s"><v>0</v></c><c r="C1" s="1"/><c r="D1" s="1"/><c r="E1" s="1"/><c r="F1" s="1"/><c r="G1" s="1"/><c r="H1" s="1"/><c r="I1" s="1"/></row> ``` I tried to open the file by LibreOffice. Everything good. A1 cell does not contains anything. I saved the opened file to other file. The new file was successfully parsed. The first row in the new file does not have A1 cell. ``` <row collapsed="false" customFormat="false" customHeight="true" hidden="false" ht="35" outlineLevel="0" r="1"><c r="B1" s="1" t="s"><v>0</v></c><c r="C1" s="1"/><c r="D1" s="1"/><c r="E1" s="1"/><c r="F1" s="1"/><c r="G1" s="1"/><c r="H1" s="1"/><c r="I1" s="1"/></row> ``` How to be in this case ? Thanks,
Ramzec commented 2016-07-25 22:44:45 +00:00 (Migrated from github.com)

I I have opened a pull-request
https://github.com/protobi/js-xlsx/pull/40

I I have opened a pull-request https://github.com/protobi/js-xlsx/pull/40
sarahkevinking commented 2016-10-11 07:10:50 +00:00 (Migrated from github.com)

This could be related to #207.

This could be related to #207.
pietersv commented 2016-10-11 16:33:12 +00:00 (Migrated from github.com)

protobi#40 is merged, just on the repo and on the master branch (i.e. not in the #beta branch and not in npm).

protobi#40 is merged, just on the repo and on the master branch (i.e. not in the #beta branch and not in npm).
reviewher commented 2017-03-01 09:18:39 +00:00 (Migrated from github.com)

@Ramzec ECMA-376 doesn't technically prohibit a cell like the example you gave, and since Excel appears to omit the cell I think the best course of action is to treat it as a stub cell

@flowhamster this is not related to #207 -- the other issue pertained to XML namespacing.

@Ramzec ECMA-376 doesn't technically prohibit a cell like the example you gave, and since Excel appears to omit the cell I think the best course of action is to treat it as a stub cell @flowhamster this is not related to #207 -- the other issue pertained to XML namespacing.
SheetJSDev commented 2017-04-13 08:04:12 +00:00 (Migrated from github.com)

@Ramzec if you still have the original file, can you test against the latest version? We've reworked how stub cells work and you should not encounter that issue.

@Ramzec if you still have the original file, can you test against the latest version? We've reworked how stub cells work and you should not encounter that issue.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#445
No description provided.