excelize-wasm
excelize-wasm copied to clipboard
how to read excel in browser?
Description
Steps to reproduce the issue: how to read excel in browser?
Describe the results you received:
Describe the results you expected:
Output of node -v:
Output of npm -v:
Output of go version:
(paste your output here)
Excelize version or commit ID:
(paste here)
Environment details (OS, Microsoft Excel™ version, Browser version, physical, etc.):
Good afternoon @jamninetyfive .
Today I encountered the same problem as you.
Here is an example code for reading Excel file data from the browser, unfortunately the performance is low.
It takes 40 seconds to read a file weighing approximately 8 megabytes (190,000 lines * 6 columns).
Example code:
<html lang="en">
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.min.js"></script>
</head>
<body>
<input type="file" id="convert-button" multiple />
<script type="module" lang="js">
document
.getElementById("convert-button")
.addEventListener("change", async function (e) {
var excelize = await excelizeWASM.init(
"https://cdn.jsdelivr.net/npm/[email protected]/excelize.wasm.gz"
);
let reader = new FileReader();
reader.onload = function () {
let byteArray = new Uint8Array(reader.result);
let f = excelize.OpenReader(byteArray);
let rows = f.GetRows("<Sheet name>");
console.log(rows);
};
reader.readAsArrayBuffer(this.files[0]);
});
</script>
</body>
</html>
This may not be the best use of the library, but I hope it helps you.
I would be glad for any corrections, good luck.
Thank you for your try and reply. I have gained something. I think the time-consuming part may be in buffer conversion, but thank you for trying. Can it read images? @CapitanHeMo
Thank you for your try and reply. I have gained something. I think the time-consuming part may be in buffer conversion, but thank you for trying. Can it read images? @CapitanHeMo
I've tried this, tried reading 4000 images, it took 4 hours, my chrome crashed, and I can't stop it, there doesn't seem to be a solution.