Upload excel sheet in ionic & read its data

How can i import an excel sheet & read its data in my App?

You could look into something like:

Personally I would recommend doing any reading of the excel file server side and returning the results to your app.

Actually I need to import excel sheet from device then i need to read its data

Ms @niallr I am trying to use js-xlsx for reading excel file for my ionic app as shown:
var workbook = XLSX.readFile('john.xlsx');
it give me this error:

TypeError: Cannot read property ‘readFileSync’ of undefined

I search for it. I found that ‘readFile’ method is for nodejs - so it for server side not for client side.
so this library is for nodejs not for angularjs and ionic , it is correct ?

You can do something like this:

var url = ‘excelfile.xlsx’;
var workbook;
var oReq = new XMLHttpRequest();
oReq.open(“GET”, url, true);
oReq.responseType = “arraybuffer”;
oReq.onload = function(e) {
var arraybuffer = oReq.response;
var data = new Uint8Array(arraybuffer);
var arr = new Array();
for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
var bstr = arr.join(“”);
workbook = XLSX.read(bstr, {type:“binary”});
console.log(‘loaded’);
/* do the work with xls here */
}
oReq.send();

This code work well in browsers (where readFileSync aren’t defined), so I suppose that can works also in ionic app…