I am trying to use the OleDb connection to fill a data table with data from an excel file, however I am receiving the following error: "Could not find installable ISAM".
Any help would be much appreciated.
I have tried the advice from other similar error posts to no avail.
string cnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;'C:\Users\Nick\Documents\Visual Studio 2010\Projects\ExcelTest1\ExcelTest1\CapitalPlan.xlsx';Extended Properties=" + "\"Excel 12.0 Xml;HDR=YES;IMEX=1\"";
DataTable dt = new DataTable();
`string sql = "Select * From [Sheet1$]";`
`using (OleDbConnection cn = new OleDbConnection(cnStr))
{
using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, cn))
{
adapter.Fill(dt);
}
}`
Answer below:
string cnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Docs\\Book2.xlsx;Extended Properties='Excel 12.0 xml;HDR=YES;'";
It was the syntax in the OleDb connection string.
More detail: How to read an .XLSX (Excel 2007) file using ADO.NET? I am finding "Could not find installable ISAM"-error