title: C# 3.5 Reading Excel files
body: <p>I have a strange behavior when i try to read an XML worksheet using this code :</p>
  
  <pre><code>string CONNEC_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=No;IMEX=2;\"";
              string fullFilePath = @"C:\Tmp\TestFile.xls";
              using (OleDbConnection objCon = new OleDbConnection(string.Format(CONNEC_STRING, fullFilePath)))
              {
                  using (OleDbCommand cm = new OleDbCommand("Select * From [MYCELLSRANGE]", objCon))
                  using (OleDbDataAdapter da = new OleDbDataAdapter(cm))
                  {
                      DataTable dt = new DataTable();
                      objCon.Open();
                      da.Fill(dt);
                      objCon.Close();
                  }
              }
  </code></pre>
  
  <p>If the Excel file is closed, I receive the error 'External table is not in the expected format.'
  When I open the file, if I execute the above code, it works fine and I can read data contained in MYCELLSRANGE.
  So, has anyone any idea about this problem ?
  Thanks for answers.</p>