I’m trying to upload an excel file.
I have an ASP.NET test site on my local machine,where the upload works fine.
However, when I put the same site onto a server machine and then try to upload, it gives me an error message:
“Microsoft.ACE.OLEDB.12.0 is not registered on local machine”
Here is my connection string (for localhost):
cn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fullpathname + ";Extended Properties=;Excel 12.0;HDR=No;IMEX=1");
This works on the server with (Microsoft.JET.OLEDB.4.0) but the same gives an error on my local host, so its vice-versa:
cn = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + fullpathname + ";Extended Properties=;Excel 12.0;HDR=No;IMEX=1");
I have tried to google this but couldn’t find a good solution, tried of some of the answers like changing the build configuration,still doesn’t work. Right now in my visual studio the build configuration is set to “Any CPU” (with reference to this SO:Question)
My server machine does not have Microsoft office installed, could that be a problem?
Thanks in advance.
You need to upload first your Excel file on your server then your method will read that excel file located on you server.
Read and Display Data From an Excel File (.xsl or .xlsx) in ASP.NET
Share “YourFileFolder” where excel file will be uploaded and add ‘Network Service’ account having read/write permission
Regards