AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



java-file-handling: write a program to read a list of emails from Csv file using java?

Answer the above query as early as possible.

java x 210
file-handling x 8
Posted On : 2016-11-24 07:36:11.0
profile MOHAMMAD SALEEM BASHA - anyforum.in MOHAMMAD SALEEM BASHA
266150
up-rate
5
down-rate

Answers


package in.anyforum;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class CSVReader {

public static void main(String[] args) {

String csvFile = "/Users/csv/email.csv";
String line = "";
String cvsSplitBy = ",";

try (BufferedReader br = new BufferedReader(new FileReader(csvFile))) {

while ((line = br.readLine()) != null) {

// use comma as separator
String[] emails= line.split(cvsSplitBy);

System.out.println("Email="+emails[3]);//if Email is 4th column in excel sheet

}

} catch (IOException e) {
e.printStackTrace();
}

}

}

Posted On : 2016-11-27 00:55:57
Satisfied : 1 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523185418912
Reply This Thread
up-rate
5
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in