Skip to content

Instantly share code, notes, and snippets.

@chaitanyamannem
Created May 7, 2020 14:44
Show Gist options
  • Save chaitanyamannem/8a45fe6bff629738a8ad05f49b9e647b to your computer and use it in GitHub Desktop.
Save chaitanyamannem/8a45fe6bff629738a8ad05f49b9e647b to your computer and use it in GitHub Desktop.
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import java.io.BufferedReader;
import java.io.FileReader;
public class CsvReader {
public static void main(String[] args) {
try(
BufferedReader br = new BufferedReader(new FileReader("Sacramentorealestatetransactions.csv"));
CSVParser parser = CSVFormat.DEFAULT.withDelimiter(',').withHeader().parse(br);
) {
for(CSVRecord record : parser) {
System.out.println(record.get("price"));
}
} catch (Exception e) {
System.out.println(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment