Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to read excel in browser? #17

Open
jamninetyfive opened this issue Sep 25, 2023 · 3 comments
Open

how to read excel in browser? #17

jamninetyfive opened this issue Sep 25, 2023 · 3 comments

Comments

@jamninetyfive
Copy link

jamninetyfive commented Sep 25, 2023

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.):

@CapitanHeMo
Copy link

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/excelize-wasm@0.0.4/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/excelize-wasm@0.0.4/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.

@jamninetyfive
Copy link
Author

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

@jamninetyfive
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants