title: How do you get the name of the first page of an excel workbook?
body: <p>Suppose you don't know the name of the first worksheet in an excel workbook. And you want to find a way to read from the <em>first</em> page. This snippet sometimes works, but not always. Is it just me? Or is there a no brainer way to do this?</p>
  
  <pre><code>            MyConnection = new System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + inputFile + "';Extended Properties=Excel 8.0;");
  
              String[] excelSheets = new String[tbl.Rows.Count]; 
              int i = 0;
              foreach (DataRow row in tbl.Rows)
              {
                  excelSheets[i] = row["TABLE_NAME"].ToString();
                  i++;
              }
              string pageName = excelSheets[0]; 
  
              OleDbDataAdapter myAdapter = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM [" + pageName + "]", MyConnection);
  </code></pre>
  
  <p>Note: I am looking for the <strong><em>name</em></strong> of the first worksheet.</p>