You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by karthik g <re...@gmail.com> on 2011/03/31 09:18:55 UTC

parse/read CSV files

Hi,

i would like to know about to read/parse csv files.

it would be great if you provide any sample code for the same

-- 
Thanks & Regards,
Karthick.G
9884198362

Re: parse/read CSV files

Posted by Nick Burch <ni...@alfresco.com>.
On Thu, 31 Mar 2011, karthik g wrote:
> i would like to know about to read/parse csv files.

POI only supports the excel formats (.xls and .xlsx). To handle CSV files, 
you probably want Apache Commons CSV

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: parse/read CSV files

Posted by jt...@externos.gbancaja.com.
Some time ago I made a comparison between different frameworks for working 
with csv files. Of all, supercsv framework was my chose. Here is an how to 
do example for read: 



            InputStreamReader inputReader = new InputStreamReader(
                    new FileInputStream(_sourceFile), _inputCharset);

            CsvListReader reader = new CsvListReader(inputReader,
                    _preferences.getSuperCsvPreferences());

            int tempLength;
            List<String> currentLine;

            while ((currentLine = reader.read()) != null) {

                row++;

                tempLength = currentLine.size();

                for (j = 0; j < tempLength; j++) {
                    column++;

                    columnValue = currentLine.get(j);
                    //do something with columnValue...
                }

            }


it's simple...

Regards



Hi,

i would like to know about to read/parse csv files.

it would be great if you provide any sample code for the same

-- 
Thanks & Regards,
Karthick.G
9884198362


**********************************************************************************************
No imprimas este correo si no es absolutamente necesario. Piensa en el medio ambiente.

Este mensaje y los ficheros anexos que, en su caso, incorpore pueden contener informaci�n confidencial o 
de uso exclusivamente interno de CAJA DE AHORROS DE VALENCIA, CASTELLON y ALICANTE, 
BANCAJA, sujeto a secreto profesional.
Si Ud. lo recibe por error o considera que no es el destinatario del mismo, deber� destruirlo y comunicar al 
emisor esta circunstancia, no pudiendo en ning�n caso distribuir, divulgar ni copiar el mensaje.

**********************************************************************************************