tags:

views:

55

answers:

6

I have a directory where files are constantly updated. I need to read the latest excel file and convert it into tab delimited file. It is under windows. A batch + java solution will work for me. Or if I can use excel in command line programatically that also works

A: 

In Java you can use, for example, Apache POI library to read data from Excel files. And then use standard Java facilities to write data into tab delimited file.

Andriy Sholokh
A: 

You can read in the excel sheet using POI and then iterate through the cells, writing them out to a separate file with appropriate delimiters.

stark
A: 

Have a look at other SQ question: http://stackoverflow.com/questions/3933515/convert-excel-to-csv-either-using-shell-script-or-jython-if-so-how/

I answered with PyODConverter, but there is jodconverter: Java version of this tool. It uses OpenOffice working as a service. I use it to convert between various file formats.

Michał Niklas
A: 

You can use Apache POI API for reading the excel file and OpenCSV for writing the CSV file.

irishbuzz
A: 

It has already been widely suggested, POI is probably the most complete "pure Java" implementation of Excel.

In one API you get support for Excel 2003 and 2007.

However, you need to be weary of its memory footprint. It is a hog. If you use it, make sure you use the event-driven model it supports as this will reduce footprint and execute faster.

iggymoran
+1  A: 

I would disagree with those people who recommend Apache POI. The best API that I know of for dealing with Excel is Andy Khan's JExcel.

duffymo
Some arguments just from me for Apache POI: 1. POI is implemented by well-known community Apache. On the contrary - JExcel is implemented by one guy, whom I don't know. 2. I have successful experience using POI. So my vote is for POI.
Andriy Sholokh
That's fine - I've had success with JExcel, so I'm voting for it. SpringSource has a JExcel View, but none for POI. They don't seem to think that POI is important or successful enough to create a View for it. Just another data point besides me.
duffymo