I'm building web page that can read any Excel file with any number of sheets, print them in table, and then store them in PhpMyAdmin database.
I need to know if there is any function to count number of sheets and read them one by one to store their names as new tables and store their values in PhpMyAdmin database.
<div id="navbar"><span>Excel File - SheetJS</span></div>
<div id="wrapper">
<input type="file" id="input-excel" />
</div>
$('#input-excel').change(function(e) {
var reader = new FileReader();
reader.readAsArrayBuffer(e.target.files[0]);
reader.onload = function(e) {
var data = new Uint8Array(reader.result);
var wb = XLSX.read(data,{type:'array'});
var htmlstr = XLSX.write(wb,{sheet:"sheet no1", type:'binary',bookType:'html'});
$('#wrapper')[0].innerHTML += htmlstr;
}
});
This code will read only the first sheet.
I'm only in the beginning. I just want to make sure that all the data in all sheets will be printed. After that I will move to next step to store them in database.
I didn't use anything rather than JavaScript and HTML.