V
vtwin
I'm trying to open a connection to an excel 2007 file ( xlsx ) with
OleDbConnection.
The excel file in question contains a couple of worksheets, some of them
have graphs/charts on it and no data.
This is the connection string I use:
string con = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source = " + fileName
+ ";Extended Properties =\"Excel 12.0 Xml;HDR=YES;IMEX=1\";";
OleDbConnection DBCon = new OleDbConnection(con);
DBCon.Open(); // failed
It failed with an "External table is not in the expected format" exception.
Two points I found:
1. It works fine if I have the excel file open
2. It works fine if I remove all the worksheets with the graphs/charts in it
My question is if there is any option to include in the connection string to
ignore the graph/chart in the excel file? Just so that the connection to the
file can be opened..
any help will be much appreciated..
OleDbConnection.
The excel file in question contains a couple of worksheets, some of them
have graphs/charts on it and no data.
This is the connection string I use:
string con = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source = " + fileName
+ ";Extended Properties =\"Excel 12.0 Xml;HDR=YES;IMEX=1\";";
OleDbConnection DBCon = new OleDbConnection(con);
DBCon.Open(); // failed
It failed with an "External table is not in the expected format" exception.
Two points I found:
1. It works fine if I have the excel file open
2. It works fine if I remove all the worksheets with the graphs/charts in it
My question is if there is any option to include in the connection string to
ignore the graph/chart in the excel file? Just so that the connection to the
file can be opened..
any help will be much appreciated..