title: C# - Importing Excel file without knowing the sheet name
body: <p>I'm trying to import an Excel file and my logic to do that is correct : </p>
  
  <pre><code>private void SaveFileToDB(UploadedFile uploadedFile)
  {
          string path = Server.MapPath("uploads/" + uploadedFile.FileName);
  
  
          int currentContractId = Convert.ToInt32(Session["id"]);
  
          string connnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;";
          OleDbConnection con = new OleDbConnection(connnection);
          OleDbCommand command = new OleDbCommand();
  
          DataTable dt = new DataTable();
          OleDbDataAdapter myCommand = new OleDbDataAdapter(**"select * from [Sheet1$]"**, con);
  
          myCommand.Fill(dt);
          int count = 0;
          //some code...
  
  }
  </code></pre>
  
  <p>As you can see, I'm hardcoding the name of the Excel Sheet in my command and I wanted to know how to proceed to make it dynamic.</p>