title: Reading Excel file on the server
body: <p>I have asp.net application which loads excel file to read. It works fine on my local development server. However when I upload it to server it wont display the uploaded excel file.
  I have MS Office installed on my local machine but not on server. 
  Thanks for your guidance </p>
  
  <p>The code I am using is...</p>
  
  <pre><code>if (fileExtension == ".xls")
              {
                  connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""; 
              }
              else if (fileExtension == ".xlsx")
              {
                  connectionString = "Provider=Microsoft.ACE.OLEDB.14.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 14.0;HDR=Yes;IMEX=2\"";
              }
              //Create OleDB Connection and OleDb Command
              OleDbConnection con = new OleDbConnection(connectionString);
              OleDbCommand cmd = new OleDbCommand();
              cmd.CommandType = System.Data.CommandType.Text;
              cmd.Connection = con;
              OleDbDataAdapter dAdapter = new OleDbDataAdapter(cmd);
              DataTable dtExcelRecords = new DataTable();
              con.Open();
              DataTable dtExcelSheetName = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
              string getExcelSheetName = dtExcelSheetName.Rows[0]["Table_Name"].ToString();
              cmd.CommandText = "SELECT * FROM [" + getExcelSheetName +"]";
              dAdapter.SelectCommand = cmd;
              dAdapter.Fill(dtExcelRecords);
              con.Close();
              GridView1.DataSource = dtExcelRecords;
              GridView1.DataBind();
  </code></pre>
  
  <p>I keep getting error</p>
  
  <pre><code>  " The 'Microsoft.ACE.OLEDB.14.0' provider is not registered on the local machine."
  </code></pre>
  
  <p>Even though I installed Access db and I can see ACE 14.0 still I keep getting this error</p>