I am trying to convert an uploaded XLSX file to JSON using https://github.com/bgrins/filereader.js to handle the upload and https://github.com/SheetJS for converting the file to JSON. This is my code:
var opts = {
dragClass : 'drag',
on: {
load: function(e, file) {
var result = e.target.result;
var xlsread = XLSX.read(result, {type: 'binary'});
var xlsjson = XLSX.utils.sheet_to_json(xlsread.Sheets.Sheet1);
console.log(xlsread,xlsjson);
}
}
};
$("#file-input, #dropzone").fileReaderJS(opts);
All I get is an empty array
Any suggestion?