Link to home
Start Free TrialLog in
Avatar of AlHal2
AlHal2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Connection string to xls and xlsx files

This connection string works when I connect to an xls file, but not an xlsx file.

           ConnString = String.Format("provider=Microsoft.Jet.OLEDB.4.0; " & _
                "data source='{0}';" & _
                "Extended Properties=""Excel 8.0; IMEX=1; HDR=No;""", _
                InputFile)

How can I make it work for an xlsx file?
Avatar of Rikin Shah
Rikin Shah
Flag of India image

Avatar of AlHal2

ASKER

With this connection string  I got a message

An OLE DB Provider was not specified in the ConnectionString.  An example would be, 'Provider=SQLOLEDB;'.

"Microsoft.ACE.OLEDB.12.0; data source=C:\test.xlsx;Extended Properties="Excel 12.0;";"
ASKER CERTIFIED SOLUTION
Avatar of Rikin Shah
Rikin Shah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlHal2

ASKER

Thanks.  I modified it slightly and it worked.

"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\Test.xlsx;Extended Properties="Excel 12.0; IMEX=1; HDR=No;""