Solved

A CSV parser in C#

Posted on 2008-10-06
4
1,373 Views
Last Modified: 2013-12-17
Hello

Can someone please help me with a parser in C# for retrieving email addresses in a  CSV file
The CSV file could be from Microsoft Outlook or a Palm Desktop

thanks
0
Comment
Question by:jbajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 5

Expert Comment

by:sciphre
ID: 22653832
I'm pretty sure that you can find a fast C# CSV parser in the .NET library, but if you don't want to use .NET libraries this looks like a good solution:

http://www.codeproject.com/KB/recipes/Basic_CSV_Parser_Function.aspx
0
 
LVL 5

Expert Comment

by:sciphre
ID: 22653842
Actually scratch that, looks like an educational solution, here, this is the real thing:

http://www.filehelpers.com/
0
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 22656879
If you need JUST email addresses (no names, phones, etc.) the the simplest solution would be:
1. read csv file into string
2. user Regex to extract email addresses.

If you're interested I could pass you some sample code.

R
0
 
LVL 5

Accepted Solution

by:
sciphre earned 500 total points
ID: 22656953
The Microsoft Outlook csv file contains 92 (!) fields.
Don't homebrew a parser, it will bite you in the fleshy part of your back side many times over as you try to maintain it.

Look at it this way: if you make a small regex to extract email addresses (which you will not get right on first try), and at some point someone decides they also want to extract names, you need to rewrite the whole thing.
Learn how to use a .Net library (filehelper) to map CSV - next time you need to add or remove a field you just copy over the field name into the output section.
And since the whole thing is already implemented, debugged and interfaced, it's really easier to use than any homebrew, no matter how good you are.
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The 21st century solution to antiquated pagers.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question