title: Get column name from excel worksheet
body: <p>In C#, how do I get the column name from a worksheet in an Excel file? </p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>ConnectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";", "@"C:\file.xlsx"); 
  
  objConn.Open(); 
  OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM ["xlWorksheet"$]", objConn); 
  
  OleDbDataAdapter objAdapter1 = new OleDbDataAdapter(); 
  
  objAdapter1.SelectCommand = objCmdSelect; 
  
  DataSet objDataset1 = new DataSet(); 
  
  objAdapter1.Fill(objDataset1); 
  
  objConn.Close();
  </code></pre>