I need to pull data from an xls, I also need have the user be able to change the location of the file it will. So an OleDbConnection seemed like a good start, and it was until the first merged cell.
This works for all but the merged cells:
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=F:\test.xls;Extended Properties=Excel 8.0;");
cmd.CommandText = "SELECT * FROM [Sheet$]";
cmd.Connection.Open();
I found that this should allow access to the merged cells:
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\test.xls;Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;");
But then I get a Could not find installable ISAM exception on cmd.conn.open();
I followed the advice here: http://support.microsoft.com/kb/209805
And here: http://stackoverflow.com/questions/512143/error-could-not-find-installable-isam
No luck.
I’m open to other ways of pulling data from the xls. Or even if there was a command I could run on the xls to remove the mirged cells that might work.