docs.sheetjs.com/docz/static/dojo/read.html

34 lines
1.1 KiB
HTML
Raw Normal View History

2022-08-30 22:12:52 +00:00
<!DOCTYPE html>
<html>
<head><title>SheetJS + Dojo Read Demo</title></head>
<body>
<h1>SheetJS + Dojo Read Demo</h1>
(this HTML page is not minified -- feel free to view source!)<br/><br/>
<a href="https://docs.sheetjs.com">SheetJS CE Documentation</a><br/><br/>
<b>Table output:</b><br/><br/>
<div id="tbl"></div>
<script>
dojoConfig = { packages: [
{ name: "xlsx", location: "https://cdn.sheetjs.com/xlsx-latest/package/dist", main: "xlsx.full.min" }
] };
</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" data-dojo-config="isDebug:1, async:1"></script>
<script>
require(["dojo/request/xhr", "xlsx"], function(xhr, _XLSX) {
xhr("https://sheetjs.com/pres.numbers", {
headers: { "X-Requested-With": null },
// highlight-next-line
handleAs: "arraybuffer"
}).then(function(ab) {
/* read ArrayBuffer */
// highlight-next-line
var wb = XLSX.read(ab);
/* display first worksheet data */
var ws = wb.Sheets[wb.SheetNames[0]];
document.getElementById("tbl").innerHTML = XLSX.utils.sheet_to_html(ws);
});
});
</script>
</body>
</html>