title: Excel Data Reader Issues, column Names, and Sheet Selection
body: <p>I am using <a href="https://exceldatareader.codeplex.com/" rel="noreferrer">Excel Data Reader</a> to read some data in to an Entity Framework Database</p>
  
  <p>The code below is working but i need some further refinements</p>
  
  <p>First of all IsFirstRowAsColumnNames does not seem to be working as intended and I have to use .Read instead.</p>
  
  <p>The fudge i had in originally to select a particular sheet was has scuppered plans, can anyone help with this excelReader.Name at the moment is pointless unless i can specifically loop through or select a sheet, which I originally used .Read to achieve hence the conflict.</p>
  
  <p>It would also be nice to refer to the actual column header names to retrieve the data rather than indexes such as var name = reader["applicationname"].ToString() in SQL client;</p>
  
  <p>Is there perhaps a better Extension i could use to read in excel data if i can't achieve the above.</p>
  
  <pre><code>public static void DataLoadAliases(WsiContext context)
      {
          const string filePath = @"Alias Master.xlsx";
  
          var stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
  
          var excelReader = filePath.Contains(".xlsx")
                        ? ExcelReaderFactory.CreateOpenXmlReader(stream)
                        : ExcelReaderFactory.CreateBinaryReader(stream);
  
         excelReader.IsFirstRowAsColumnNames = true;
  
  
          excelReader.Read(); //skip first row
  
          while (excelReader.Read())
          {
  
              if (excelReader.Name == "Alias Master")
              {
                  var aliasId = excelReader.GetInt16(0);
                  var aliasName = excelReader.GetString(1);
  
                  //Prevent blank lines coming in from excel;
                  if (String.IsNullOrEmpty(aliasName)) continue;
  
                  context.Aliases.Add(new ApplicationAlias
                  {
                      AliasId = aliasId,
                      Name = aliasName,
                  });
              }
              else
              {
                  excelReader.NextResult();
              }
          }
  
          excelReader.Close();
          context.SaveChanges();
      }
  </code></pre>