title: Import CSV file into c#
body: <p>I'm building a website and one of the requirements is for users to export their contacts from their email client to import them into the site.</p>
  
  <p>Because each email client exports their contacts in a slightly different format this has got my head scratching has to the best way to approach it. As I don't know what the fields are, or what the delimiter is.</p>
  
  <p>I'm only looking to target the main email client/address books (outlook, apple mail, entourage, thunderbird). All of these have an entirely different format. Entourage uses tab as a delimiter where as the rest use a comma etc. I only need to pluck out the email address and (if available) a name. The name gets trickier as some clients have separate fields for first name / last name.</p>
  
  <p>Using <a href="http://www.filehelpers.com" rel="nofollow noreferrer">FileHelpers</a> would be ideal, but it seems I need to know the structure of the csv before I can hook up a solution. I'd rather not go writing my own csv parser if possible.</p>
  
  <p>Here's my thoughts for the collective hive mind:</p>
  
  <h3>Plan A</h3>
  
  <ul>
  <li>Read the first line of the csv file (all of the formats have a heading as the first row) and count the number of tabs vs commas. Determine from this the delimiter.</li>
  <li>Use some type of csv reader such as <a href="http://www.codeproject.com/KB/database/CsvReader.aspx" rel="nofollow noreferrer">Lumenworks</a> to give me basic csv reading capabilities for the rest of the file.</li>
  <li>Perform a Regex match on each field to determine the email column.</li>
  <li>No idea on how to figure out the name of the user...</li>
  </ul>
  
  <h3>Plan B</h3>
  
  <ul>
  <li>Prompt user for type of email client, and individually code it up for each different client  &lt;- seems really clunky.</li>
  </ul>
  
  <h3>Plan C</h3>
  
  <p>....Use / purchase an existing component that already does this?! (I sure can't find one!!)</p>
  
  <p>Thoughts?</p>