Question

hai guys, I have imported my gmail contacts from gmail and a file name called google.csv was download ... I want to read only the email ids in that file from asp.net... Please help me out guys....

Was it helpful?

OTHER TIPS

If I'm understanding you correctly, you want to read the CSV file that was exported from gmail and access the email records in a list. It's not difficult.

Put the csv file in your App_Data folder or wherever is convenient. Then parse the file, using a free CSV library like this one: http://www.codeproject.com/KB/database/CsvReader.aspx.

Or if you want a quick and dirty way, I noticed the google.csv has emails on the last column without quotes, so you could read the file in, split at commas, and look at the last item in the array... something like this:

List<string> emails = new List<string>();
string[] lines = File.ReadAllLines(Server.MapPath(filename));
//skip the first line
for(int x = 1; x < lines.Length; x++) {
  string[] fields = lines[x].Split(',');
  emails.Add(fields[fields.Length-1]);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top