Read Excel to Write to Database

Question

What is the best way to read excel spreadsheet?

I need to programmtically read excel spreadsheet and then insert data into a database. Although I am more inclined towards Perl or Java, I want to know the best and fastest possible way. Language and technology no bar. Also, if it's open source, then better.

 

A reply:

Have you looked at jq? It's a utility, but it's open source and has its own parsing syntax akin to XPath. You could probably also port it.

Similarly, almost every language out there has a very current and powerful library for parsing JSON. Python has simplejson, Ruby has, uh, the "json" gem, Java has Jackson JSON Processor - Home, the list goes on.

 

Answer

You need to execute cpan Spreadsheet::ParseExcel command to install the related Perl class before calling the language’s interface to access Excel. Java accesses Excel using POI, but it handles data type and data calculation, such as conditional filtering, data grouping and join, in a complex way. Here you can use esProc to make the process efficient and fast. It needs only a one-line (=file("D:\\data.xls").xlsimport()) and supports viewing the loaded data on IDE. It also offers JDBC interface to conveniently write the Excel data into a database. It’s not open source, but it provides a free edition.