title: CsvReader to ignore blank column
body: <p>I am using CSVhelper for the first time. Another program is exporting a csv file the file looks like this</p>
  
  <pre><code>,"Employee","Earnings 1/Rate","Note"
  ,"John Doe","Regular 10.50", "Started Sep 1"
  </code></pre>
  
  <p>The problem is that I have a blank column to contend with at the start. I don't want the user to have to delete column using excel in order to use the file. So how can I either ignore the first column or get the column to add to my datatable.</p>
  
  <p>The error (see comment line near bottom of program) is Field Blank does not exist in csv file</p>
  
  <p>My class for reading in the data</p>
  
  <pre><code>namespace PayRateTracker
  {
      public class TestRecord
      {
          public string Blank { get; set; }
          public string Employee {get; set;}
          public string Earning { get; set; }
          public string Note { get; set; }
      }
  
      public class MyClassMap : CsvClassMap&lt;TestRecord&gt;
      {
          public override void CreateMap()
          {
              Map(m =&gt; m.Blank).Index(0);
              Map(m =&gt; m.Employee).Index(1);
              Map(m =&gt; m.Earning).Index(2);
              Map(m =&gt; m.Note).Index(3);
          }
      }
  }
  </code></pre>
  
  <p>I have a comment were the error is occurring near the bottom</p>
  
  <pre><code>namespace PayRateTracker
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
  
               //Stream reader will read test.csv file in current folder
               StreamReader sr = new StreamReader(@"G:\2013-09-20.csv");
  
               //Csv reader reads the stream
               CsvReader csvread = new CsvReader(sr);
  
              //csvread will fetch all record in one go to the IEnumerable object record
               IEnumerable&lt;TestRecord&gt; record = csvread.GetRecords&lt;TestRecord&gt;();
  
               //foreach (var rec in record) // Each record will be fetched and printed on the screen
               //{
               //    lblDisplay.Text = (string.Format("Name : {0}, Amount : {1}, Notes : {2} &lt;br/&gt;", rec.Employee, rec.Earning, rec.Note));
               //}
               sr.Close();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              DataTable dt = new DataTable();
              using (var stream = File.OpenRead(@"G:\Test.csv"))
              {
                  using (var reader = new StreamReader(stream))
                  {
                      using (var csvReader = new CsvReader(reader))
                      {
                          csvReader.Configuration.RegisterClassMap&lt;MyClassMap&gt;();
                          int i = 0;
                          while (csvReader.Read())
                          {
                              if (csvReader.FieldHeaders[0] == "")
                              {
                                  csvReader.FieldHeaders[0] = "Blank";
                              }
                              if (i == 0)
                              {
                                  foreach (var field in csvReader.FieldHeaders)
                                  {
                                      dt.Columns.Add(field);
                                  }
                              }
  
                              DataRow row = dt.NewRow();
                              foreach (var field in csvReader.FieldHeaders)
                              {
                                  row[field] = csvReader.GetField(field);  // &lt;-- Error here
                              }
                              dt.Rows.Add(row);
  
                              i += 1;
                          }
                      }
                  }
              }
              //return dt;
              dataGridView1.DataSource = dt;
          }
      }
  }
  </code></pre>