title: How to resolve 'The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" does not contain the table "Sheet1$" ' error?
body: <p>I am using excel data import to sql table in my .net application, however i am getting following error while saving the data : </p>
  
  <p>My code : </p>
  
  <blockquote>
  <pre><code>protected void btnSave_Click(object sender, EventArgs e)
  {
      string FileName = lblFileName.Text;
      string Extension = Path.GetExtension(FileName);
      string FolderPath = Server.MapPath (ConfigurationManager.AppSettings["FolderPath"]);
      string CommandText = "";
      switch (Extension)
      {
          case ".xls": //Excel 97-03
              CommandText = "spx_ImportFromExcel03";
              break;
          case ".xlsx": //Excel 07
              CommandText = "spx_ImportFromExcel07";
              break;
      }
      //Read Excel Sheet using Stored Procedure
      //And import the data into Database Table
      String strConnString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
      SqlConnection con = new SqlConnection(strConnString);
      SqlCommand cmd = new SqlCommand();
      cmd.CommandType = CommandType.StoredProcedure;
      cmd.CommandText = CommandText;
      cmd.Parameters.Add("@SheetName", SqlDbType.VarChar).Value = ddlSheets.SelectedItem.Text;
      cmd.Parameters.Add("@FilePath", SqlDbType.VarChar).Value = FolderPath + FileName;
      cmd.Parameters.Add("@HDR", SqlDbType.VarChar).Value = rbHDR.SelectedItem.Text;
      cmd.Parameters.Add("@TableName", SqlDbType.VarChar).Value = txtTable.Text;   
      cmd.Connection = con;
      try
      {
          con.Open();
          object count = cmd.ExecuteNonQuery();
          lblMessage.ForeColor = System.Drawing.Color.Green;
          lblMessage.Text = count.ToString() + " records inserted.";  
      }
      catch (Exception ex)
      {
          lblMessage.ForeColor = System.Drawing.Color.Red;     
          lblMessage.Text = ex.Message;  
      }
      finally
      {
          con.Close();
          con.Dispose();
          Panel1.Visible = true;
          Panel2.Visible = false; 
  </code></pre>
  </blockquote>
  
  <pre><code>    }
  }  
  </code></pre>
  
  <p>and i am using connections strings for excel formats in web.config as : </p>
  
  <pre><code>&lt;connectionStrings&gt;
  &lt;add name="Excel03ConString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1}'"/&gt;
      &lt;add name="Excel07ConString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0;HDR={1}'"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>i could not figure out this error. Can anyone help ?</p>