Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

csv-commons - withSkipHeaderRecord option doesn't skip anything

I have usual csv file with header

f1, f2, f3
1, 2, 3

and I try to parse it:

 Iterable<CSVRecord> records = CSVFormat.EXCEL.withIgnoreEmptyLines().withSkipHeaderRecord().parse(in);
            records.forEach(record -> {
               ...

But anyway the first record is header anyway.

What do I wrong?

like image 596
gstackoverflow Avatar asked Oct 25 '25 09:10

gstackoverflow


1 Answers

specify that file have header to skip:

CSVFormat.EXCEL.withHeader().withSkipHeaderRecord();
like image 130
SVK PETO Avatar answered Oct 28 '25 01:10

SVK PETO