You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Arnolds, Juliana" <ja...@constantcontact.com> on 2010/03/10 06:31:54 UTC

Converting xls and xlsx files to csv

Hi,
I've found the 2 examples for converting xls and xlsx files to csv and have them working.  In case someone is searching like I was, here are their locations:

http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java
http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java

I need to be able to convert both xls and xlsx files so I could easily create two methods and call them depending on the file extension.

However, my question is whether or not it would be possible using the WorkbookFactory and ExtractorFactory classes to handle both types rather than having the two code paths.

There is a lot of code in the above examples and being new to this API, I haven't waded through what Is essential and which classes to use such that both XLS and XLSX formats can be supported.

Thanks in advance for any suggestions -
J