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

Number Format clashing with standard built-in format #506

Closed
asksahil opened this issue Nov 21, 2016 · 2 comments
Closed

Number Format clashing with standard built-in format #506

asksahil opened this issue Nov 21, 2016 · 2 comments
Labels

Comments

@asksahil
Copy link

Hi,

I have an excel file which I am trying to parse using sheetjs xlsx.js plugin.

Attached is the excel file.
Financial Data All Metrics 161121.xlsx

Below is the code which I am using to get the sheetname and worksheet objects.
Even though the sheet name firstSheetName is retrieved successfully, the worksheet object comes out as null.

reader.onload = function(e,f) {
var data = e.target.result;
var workbook
workbook = XLSX.read(data, {type : 'binary'});
var firstSheetName = workbook.SheetNames[0]
var worksheet = workbook.Sheets[firstSheetName]
};

I have tried to parse the file at http://oss.sheetjs.com/js-xlsx/ but there too it did not work.

@asksahil
Copy link
Author

Hello,

Thank you for the fix. Though there are some issues still pending. Even though the excel is parsing now, its unable to parse the date fields correctly. Example, the date is parsed like a number "40909" instead of "3/31/2012"

@SheetJSDev
Copy link
Contributor

@asksahil It looks like this file is attempting to override the standard number formats. It is attempting to set number format 1 to a date:

<numFmts>
<numFmt numFmtId="0" formatCode="General"/>
<numFmt numFmtId="1" formatCode="MM/dd/yyyy"/>
<numFmt numFmtId="2" formatCode="$#,##0.00"/>
</numFmts>

However number format 1 is a no-decimal number. The standard number formats are listed in the table_fmt variable. The tool should be writing to the custom number format ranges:

5-8
23-26
41-44
63-66
164-392

https://github.com/SheetJS/js-xlsx/blob/master/bits/47_styxml.js#L225

Either way, since Excel isn't raising any issues with that, it's worth changing the assumption.

@SheetJSDev SheetJSDev reopened this Mar 20, 2017
@SheetJSDev SheetJSDev changed the title Excel not parsed by xlsx.js. Returns SheetName but not WorkSheet Number Format clashing with standard built-in format Mar 20, 2017
@reviewher reviewher added the SSF label Mar 25, 2017
saarCiklum pushed a commit to Folcon/js-xlsx that referenced this issue Aug 18, 2020
- decode sheet name for XLSX and XLML (fixes SheetJS#203 h/t @rocketmonkeys)
- XFExt (fixes SheetJS#298 h/t @aetna-softwares @aimcom @baharudinafif)
- handle truly empty `<is>` elements (fixes SheetJS#506 h/t @asksahil)
- pin version numbers for dependencies (fixes SheetJS#469 h/t @nhtera)
- sed usage fix (see SheetJS#572 h/t @Liryna)
- fix hex2RGB substr indices (fixes SheetJS#294 h/t @kamorahul)
- removed stale typescript files (see SheetJS#442)
- reworked shift formula regex (fixed SheetJS#551 h/t @SheetJSDev)
- README note on webpack codepage suppression (fixes SheetJS#438 h/t @rusty1s)
- README note on WTF (fixes SheetJS#487 h/t @livesoftware)
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
Projects
None yet
Development

No branches or pull requests

3 participants