How to read mixed data type values from Excel in Asp.net?


Mixed data type values can be read from excel file with the following Connection strings.
For Excel file below 2007 Version.

OleDbConnection Con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ExcelFilePath + @"; Extended Properties=Excel8.0;IMEX=1;HDR=NO;ImportMixedTypes=Text");


For Excel file 2007 and above Version.

OleDbConnection Con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ExcelFilePath + @"; Extended Properties=Excel12.0;IMEX=1;HDR=NO;ImportMixedTypes=Text");


IMEX=1
It means columns can have multiple datatype values.
HDR=NO
It means No header row.
ImportMixedTypes=Text
It means All mixed datatype columns will be treated as Text Type.