简体   繁体   中英

js-xlsx: how to read local file without HTML5

Im trying to use js-xlsx ( https://github.com/SheetJS/js-xlsx ) to read a xlsx file that will be inputed by the user in a html file input. However I don't think the API that i'm developing this on supports HTML5 file handling. I'm getting: "$(...).addEventListener is not a function" in the console. The lib has an alternative for older browsers, but is an ajax call and I want to read a file inputed by the user on the fly.

Im using the functions available as examples in the github above.

Can I do this or I have to upload the file first to my server and then work on it with ajax?

Sorry if this is not a proper question, didnt seen to find the answer anywhere.

There is no way you can read/write xlsx files without using third party plugins like js-xlsx.

However another method you can try is:

  • Convert and save xlsx file as xml.
  • Load xml file using ajax call and parse the structure.

我设法使其与HTML5一起使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM