Reputation: 37
I've been searching this everywhere, I'm probably just being thick but is there a way to read a csv file from a particular row onwards? I have a csv file but want to read the data from the 14th row onwards. Below is my csv reader.
CSVReader reader=new CSVReader(new FileReader(filename1));
String [] value ;
while((value=reader.readNext())!=null){
The data inside the csv is something like this
1 djennings93
2 27/02/2014
3 13:31
...
14 26/02/14 14:25:00, www.google.co.uk, 50, Google
I'd like to ignore the data from lines 1-13
Upvotes: 3
Views: 6529
Reputation: 1448
Boris's answer still works but deprecated. It is recommended to use builder class:
CSVReader reader = new CSVReaderBuilder(new FileReader("yourfile.csv"))
.withSkipLines(13)
.withCSVParser(new CSVParserBuilder().withSeparator('\t').withEscapeChar('\'').build())
.build();
Upvotes: 3