I am trying to read Excel, the code I am using runs in one project and is giving error "External table is not in the expected format." for same Excel Input in another project. What may be the issue for code to fail?- My connection string is " strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=\"Excel 8.0;HDR=" + HDR + ";IMEX=0\"";"
Asked
Active
Viewed 1,148 times
1 Answers
0
You need to put single quotes around the Extended properties value.
1. conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.15.0;Data Source=C:\Users\Input.xlsx;Extended Properties='Excel 15.0 Xml'");
2. conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.14.0;Data Source="+FilePath+";Extended Properties='Excel 14.0 Xml'");
3. conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Input.xlsx;Extended Properties='Excel 12.0 Xml'");
-
I have made suggested changes as- Provider=Microsoft.ACE.OLEDB.15.0;Data Source=C:\Users\20088038\Desktop\Pratik\iESSAM\Input Provided\iESSAM_format_input.xlsx;Extended Properties='Excel 15.0 Xml'------------------but it still gives the same error – Pratik Jan 13 '17 at 10:48