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
Solved

A CSV parser in C#

Posted on 2008-10-06
4
1,351 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best bluetooth visor clips 1 26
Help with error in Query 2 31
texting service for android tablet 3 15
Need a simple RegEx to search for two words 27 44
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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