Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to connect Excel 2010 .xslm thru below connection string: -

CSS
string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;
               Data Source=F:\Project Chunauti\OCCL Mundra Dashboard U1.xlsm;Extended Properties=""Excel 12.0 Macro;\""";


It works only when the mentioned file is opened in excel. But for .xlsx file it works.

Query result also gone very slow to fill C# datagridview.

When this file is not opened, it gives an error "External table is not in the expected format."

Any idea please.

--- Thanks.
--- Anil
Posted

1 solution

In some cases you need to add special properties, like: HDR=yes and /or IMEX=1
For further information have look here: http://www.connectionstrings.com/excel/[^]

If it won't help, please provide more details about your data structure.
 
Share this answer
 
Comments
anil_kumar_bhakta 10-Mar-14 0:22am    
Already tried but no improvement.
Maciej Los 10-Mar-14 13:57pm    
Please read the last sentence in my answer...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900