"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=localhost;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=2"
What is the purpose of IMEX=2
in the above connection string?
From ConnectionStrings
"If you want to read the column headers into the result set (using HDR=NO even though there is a header) and the column data is numeric, use IMEX=1 to avoid crash.
To always use IMEX=1 is a safer way to retrieve data for mixed data columns. .."
Please note that the IMEX value can be very important when you need to write back data to the Excel. A fast search on Internet on IMEX found numerous articles about problems with various IMEX values