title: Query excel sheet in c#
body: <p>I want to read Excel file in c# using following code</p>
  
  <pre><code>string excelFileName = "Book2.xls";
  string excelConnectString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Book2.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
  //string excelConnectString = @"Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " + excelFileName + ";" + "Extended Properties = Excel 8.0; HDR=Yes;IMEX=1";
  
  OleDbConnection objConn = new OleDbConnection(excelConnectString);
  OleDbCommand objCmd = new OleDbCommand("Select * From [Sheet1$]", objConn);
  
  OleDbDataAdapter objDatAdap = new OleDbDataAdapter();
  objDatAdap.SelectCommand = objCmd;
  DataSet ds = new DataSet();
  objDatAdap.Fill(ds);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/C4cBf.png" alt="enter image description here"></p>
  
  <p>Everything is working fine.Now my requirement is to read the excel file something like below</p>
  
  <pre><code>SELECT A,B,D From [Sheet1];
  </code></pre>