The Easiest Way of Accessing Excel

Question

I have a large data set which is like impossible to enter manually. I have to make a program where I need that data set. Data is stored in an Excel file. What is the best way to read and edit an Excel file in Java? It would be better if I am able to make the data available even if I send the jar file of program to someone else.

 

Answer

Java can read and write an Excel file using POI, but the high-level language handles data type and manipulates data, like conditional filtering, data grouping and join, etc., in a roundabout way. You can use esProc SPL to read the Excel file. It’s simple. A one liner - =file("D:\\data.xls").xlsimport() – is enough and it’s easy to call an SPL script. The Structured Process Language produces concise code to handle the Excel data and re-write it to a target Excel file.

You can embed the SPL script into a Java program to publish, or call the SPL script from the OS command line.