I am trying to extract data from .xls, .xlsx But I am getting non-human-readable data in format as shown in image:
I have tried as many codes as I can but every code endup at same output. I want data as array of objects for each line in excel. Unfortunately I am unable to get it. Below are the codes that I have tried.
Code1: Plugin : harrison:papa-parse
$('#fileInputId').change(function(e) {
Papa.parse( e.target.files[0], {
header: true,
complete( results, file ) {
console.log(results.data);
Meteor.call( 'meteorMethodsCall', results.data, ( error, response ) => {
if ( error ) {
console.log("Upload error");
} else {
console.log("Upload success");
}
});
}
});
});
Code 2: By readFile and adding d3js:d3
var readFile = function(f, onLoadCallback) {
var reader = new FileReader();
reader.onload = function(e){
var contents=e.target.result;
console.log(contents);
onLoadCallback(contents);
};
reader.onerror = function(event) {
d3.csv.parse(csv, function( d, i) {
console.log(i);
console.log(d);
});
console.error("File could not be read! Code " + event.target.error.code);
};
reader.readAsText(f);
};
My excel file looks like: