1//head auto detection
2Reader in = new FileReader("path/to/file.csv");
3Iterable<CSVRecord> records = CSVFormat.RFC4180.withFirstRecordAsHeader().parse(in);
4for (CSVRecord record : records) {
5 String id = record.get("ID");
6 String customerNo = record.get("CustomerNo");
7 String name = record.get("Name");
8}
9//add dependemcy too
10<dependency>
11 <groupId>org.apache.commons</groupId>
12 <artifactId>commons-csv</artifactId>
13 <version>1.8</version>
14</dependency>