How to parse excel file in javascript?

I am trying to write a small web tool that takes an Excel file, parses the contents and then compares the data with another data set. Is this easy to do in JavaScript? Is there a javascript library that does this?

+6
javascript html5 parsing excel
source share
5 answers

How would you upload a file in JavaScript first?

In addition, Excel is a proprietary format and complex enough that server libraries with years of development (for example, Apache POI ) still managed to correctly redesign these Microsoft formats 100%.

So, I think the answer is that you cannot.

Update: This is in pure JavaScript.

Update 2: Now you can upload files to JavaScript: https://developer.mozilla.org/en-US/docs/DOM/FileReader

+6
source share

There have been many achievements over the past four years. The HTML5 file API has been embraced by major browser providers, and performance improvements actually allow you to parse several excel files (both xls and xlsx) in the browser.

My entries in this space:

Both are pure JS parsers

+2
source share

To do everything in js, you will need to use ActiveX and possibly office web components. Just an offer, but you probably don't want to go this route; it will be inefficient and IE / Win only. You will be better off with a server solution.

-one
source share

You will need to use ActiveX (see W3C Schools when using AJAX) and register the file on the Dataconnectors host computers (only on the computer on which the file is located). Unlike the one mentioned above, this method is independent of the Microsoft platform (for the client anyway), and you do not need to install Office components.

This can be done for most data files registered in Windows, including MDB, and allows you to control as much as you want, since you can assign different Windows accounts for different purposes.

As I said, all this is a server and does not affect the client, except, perhaps, obtaining credentials, actions and all this.

This method uses JavaScript, SQL (no, not even MSSQL, only the SQL standard) and only requires that ANY Microsoft NT platform runs on the hosting computer.

What Windows dataconnectors does is a generic interface for various data components, such as DirectX for graphics cards and other peripherals. You can also use it to bind MDB (Microsoft Access) to the MySQL server and transfer real-time data in a way that I find even easier than using XLS tables ... especially since you can import XLS into MDB.

-one
source share

Do you really need an Excel file? Why not use Excel to export data to CSV or XML and load it?

The Excel file format is very specific to the implementation of Excel. If you just need data, use a file format that simply contains data.

-2
source share

All Articles