I'm trying to use jspreadsheet from bossanova.uk to import a .xlsx file as described here. However I get an Invalid HTML: could not find <table> error. This error should mean the file is interpreted as HTML, but it's actually an xlsx file. I created an HTML input allowing the user to choose the file and a container for the spreadsheet:
<input type="file" id="inputXlsFile" />
<div id="spreadsheet"></div>
Then in Javascript:
inputElement = document.getElementById("inputXlsFile");
inputElement.addEventListener("change", handleFiles, false);
var handleFiles = function() {
const files = this.files;
jexcel.fromSpreadsheet(files[0], function(result) {
if (!result.length) {
console.error('Jspreadsheet: Something went wrong.');
} else {
if (result.length == 1) {
jexcel(document.getElementById('spreadsheet'), result[0]);
} else {
jexcel.createTabs(document.getElementById('spreadsheet'), result);
}
}
});
}
Here is a screenshot of the xlsx file opened in Excel:
