I\'m importing data from an Excel sheet on to a DataTable using the following code:
OleDbConnection con = new OleDbConnection(\"Provider=Microso
One thing you should always specify in your connection string is IMEX=1:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;IMEX=1\"
It helps with parsing columns that contain both numbers and strings. Might help with date parsing as well, but then you would have to manually convert all dates with:
System.IFormatProvider format = new System.Globalization.CultureInfo("en-US", true);
DateTime d = DateTime.Parse(dataSet.Tables[0].Rows[i]["MyDate"] as string,format);