2

I am trying to get data to sqlserver2005 on my C# windows application, from sheet1.xls file through oledb connection in visual studio-2008 and I am using windows7 os and I didn't installed excel on my system.

This is my connection string:

 string excelconnectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +excelfilepath + ";"+"Extended Properties='Excel 8.0;HDR=Yes;'";

I tried many ways but still i am getting this error :

"External table is not in the expected format. "

Please help me.

1 Answer 1

1

Use Microsoft.ACE.OLEDB.12.0 for excel files

string excelconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +excelfilepath + ";"+"Extended Properties="Excel 12.0;HDR=Yes";

connectionstrings

Sign up to request clarification or add additional context in comments.

5 Comments

i installed AccessDatabaseEngine.exe(Microsoft Access Database Engine 2010 Redistributable) and i tried again but still iam getting the same error
can you provide your connection string@FADV
string excelconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelfilepath + ";" + "Extended Properties='Excel 8.0;HDR=Yes;'"; and the excel file path is:C:\sheet1.xls
i changed the string like u given above,but still having the same problem. i am using .xls format that is old version of excel(97-2003)
It may be possible that your Excel file itself contains some invalid data. That's why OleDB will not be able to read your Excel sheet.

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.