Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse XLSX #445

Closed
rstrlcpy opened this issue Jul 25, 2016 · 5 comments
Closed

Cannot parse XLSX #445

rstrlcpy opened this issue Jul 25, 2016 · 5 comments

Comments

@rstrlcpy
Copy link

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,

@rstrlcpy
Copy link
Author

I I have opened a pull-request
protobi#40

@sarahkevinking
Copy link

sarahkevinking commented Oct 11, 2016

This could be related to #207.

@pietersv
Copy link
Contributor

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
Copy link
Contributor

@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
Copy link
Contributor

@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.

saarCiklum pushed a commit to Folcon/js-xlsx that referenced this issue Aug 20, 2020
- recalculate SSF for malformed files (fixes SheetJS#506 h/t @asksahil)
- malformed shared string (fixes SheetJS#445 h/t @ramzec)
- SSF added to TS def (fixes SheetJS#711 h/t @duckywang1)
- Norsk property names
- resolved gitbook processing issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants