AlHal2
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=Mi crosoft.Je t.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?
ConnString = String.Format("provider=Mi
"data source='{0}';" & _
"Extended Properties=""Excel 8.0; IMEX=1; HDR=No;""", _
InputFile)
How can I make it work for an xlsx file?
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;Extend ed Properties="Excel 12.0;";"
An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
"Microsoft.ACE.OLEDB.12.0;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. I modified it slightly and it worked.
"Provider=Microsoft.ACE.OL EDB.12.0; Data Source=C:\Test.xlsx;Extend ed Properties="Excel 12.0; IMEX=1; HDR=No;""
"Provider=Microsoft.ACE.OL
http://skynetr.wordpress.com/2012/03/21/tutorial-read-excel-file-content-from-c-xls-xlsx/