I\'m importing data from an Excel sheet on to a DataTable using the following code:
OleDbConnection con = new OleDbConnection(\"Provider=Microso
When linking Excel spreadsheets in MS Access, a problem arises when a column has mixed data types. For example, if the first row in the column is "Text" and the remaining are Numeric, the Numeric fields will be formatted as Text and #Error out. Likewise with Dates and non-Dates mixed in the same column.
There are some nice attempts at answers up there, but here is the simple solution to read these Mixed data types without a data type mismatch error:
Try adding "IMEX=1" to your MS Access SQL, such as:
SELECT Type, Width, Weight
FROM [Excel 8.0;IMEX=1;DATABASE=C:\TEMP\MySpreadsheet.xls].MyExcelTable
Thanks, Brian Jasmer