Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing a CSV File into Java

Tags:

java

csv

In the program I am writing, I want to be able to import CSV files. At the moment, it takes a basic text file in.

File mainemails = new File ("mainemails.txt");

I know that for CSV imports using File is probably not the most time-efficient thing to use. What would be the most efficient way to import a CSV file? Would I have to download any new libraries to use an efficient method?

like image 563
Nick Welki Avatar asked Apr 03 '12 10:04

Nick Welki


Video Answer


1 Answers

You can use opencsv for importing csv data and then constructing objects from it.

I prefer using libraries so that I can save development time. Also they tend to solve specific problems better.

like image 186
Jayan Avatar answered Sep 25 '22 19:09

Jayan