.xslx file parsing
See original GitHub issueHi
I am trying to parse excel file using this js library. I was successfully able to parse xls file. But when i am trying to parse .xlsx file its giving me error. Is their anything else require to be done. Please share.
I am using following code.
{
file = input.files[0];
fr = new FileReader();
fr.onload=function()
{
console.log("loaded");
var content=fr.result;
if(!rABS) content = new Uint8Array(content);
var Workbook = XLSX.read(content, { type: 'binary' });
console.log(Workbook);
Workbook.SheetNames.forEach(function(sheetName) {
var sheet= Workbook.Sheets[sheetName];
var roa = XLSX.utils.sheet_to_json(sheet);
console.log(roa);
roa.forEach(function(obj){
console.log(obj);
$("#"+obj.Name).val(obj.Value);
});
});
};
var data= fr.readAsText(file);
}
I am getting following error
Uncaught Error: Cannot find file [Content_Types].xml in zip
at q (xlsx.full.min.js:12)
at re (xlsx.full.min.js:12)
at rv (xlsx.full.min.js:21)
at sv (xlsx.full.min.js:21)
at Object.cv [as read] (xlsx.full.min.js:21)
at FileReader.fr.onload (registration_crud?_mode=edit&id=189_Student_process1:434)
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
json - How to parse Excel (XLS) file in Javascript/HTML5
Old question, but I should note that the general task of parsing XLS files from javascript is tedious and difficult but not impossible....
Read more >Parsing Huge XLSX files ins fastest possible way
Apache POI is the most common open source Java library used in the XLSX file parsing but it is very memory intensive, for...
Read more >Quick'n'dirty solution for parsing XLSX files on the go
Integral parts of the parser · Extract the sheet structure (sheet1.xml) into XSTRING XML · Extract the array of sheet values (sharedStrings.xml) ...
Read more >Using JavaScript to Work with Spreadsheets, Part 5: Parsing ...
You could certainly use fs.readFile() to read an XLSX file and write code to parse out the data found within. However, this is...
Read more >Parse and Read Excel Files (xls/xlsx) With JavaScript - Medium
Recently there was a requirement in one of my projects to parse Excel files (with xls/xlsx extensions) in the browser (using javascript ofcourse)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
readAsBinaryString solved the problem 😃
@harminder-emobx-com the problem is in the encoding.
readAsText
does not work with binary files. You should either be usingreadAsArrayBuffer
orreadAsBinaryString
. Follow the examples from https://github.com/sheetjs/js-xlsx#parsing-workbooks .