0

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\"";"

0

1 Answer 1

0

You need to put single quotes around the Extended properties value.

from here

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'");
Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.