XLSX.utils.sheet_to_json returning empty array
See original GitHub issueHey,
I am trying to give our users the possibility to upload an XLSX file (through ng-file-uploader), and to convert this XLSX file to JSON data afterwards. The uploading of the file works fine, this is the result when I print $scope.file in the console:
When I try to use the sheet to json function, I get an empty array back, while there is a lot of data in the uploaded XLSX file.
In my code I use the following:
XLSX.utils.sheet_to_json($scope.file);
This returns an empty array as said before. Is there something I’m forgetting or should execute differently?
Kind regards,
Thomas
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
sheet_to_json producing bad array of array - Stack Overflow
Using Angular 9, I am building a step wizard and the first step is to read and parse an .xlsx file. I have...
Read more >Utility Functions - SheetJS Community Edition
XLSX.utils.aoa_to_sheet takes an array of arrays of JS values and returns a worksheet resembling the input data. Values are interpreted as follows:.
Read more >How to use the xlsx.utils.json_to_sheet function in xlsx | Snyk
To help you get started, we've selected a few xlsx.utils.json_to_sheet ... function (rows, options) { if (!rows) { throw new Error('Empty json array...
Read more >Check for Empty/Undefined/Null String in JavaScript - Morioh
Note: If the starting point was a file or HTML table, XLSX.utils.sheet_to_json will generate an array of JS objects. Package and Release Data....
Read more >xlsx - npm
var jsa = XLSX.utils.sheet_to_json(worksheet, opts);. Create an array of arrays of JS values from a worksheet.
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
@Xsmael I solved this setting a the name of the sheet you want to use and also the header, which might help you to identify each column.
Where
workbook.SheetNames[3]
is the name of my third sheet, which is the one I’m using in this example. I hope this helps you@shamseerahammedm you could try to not use constants and creating the ‘ws’ directly within the wb.SheetName[7]