Saturday, January 28, 2012

OLE DB Connection string for Excel 2007

If you want to use Excel 2007 as a data base for your application or program, the correct connection string is:


"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="C:\my_location\my_file.xlsx;Extended Properties=\"Excel 8.0;HDR=YES;\";Jet OLEDB:Database Locking Mode=1";


HDR stands for header. By default the property is set to NO. If the first row of your Excel file sheet is a column name, set the property to YES.


Note
Do not forget to set on the "Share Workbook" property in your Excel file.

No comments:

Post a Comment