While Importint data from Excel xlsx/xls , if some column has invalid values
say the column has "TRUE/FALSE" , but some how (manual entry) it is changed to "abc" , if the column has many values as Date but some how user by mistake make it as "abc"
then the while reading from Excel through ssis script Task the column turns out to be blank, as while the data type cannot be able to validate and report data error issue to end user.
if (ext.ToUpper() == ".XLS")
{
sourceConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelFile + ";Extended Properties=\"Excel
8.0;HDR=Yes;IMEX=1\"";
}
else if (ext.ToUpper() == ".XLSX")
{
sourceConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFile + ";Extended Properties=\"Excel
12.0;HDR=Yes;IMEX=1\"";
}
Have used IMEX=1 to treat all column as string , but still it is not working. So if alll column becomes string it will accept all values
irrespective of TRUE/FALSE or abc , but IMEX=1 doesnot work out.
excelSheetName = dt.Rows[0]["TABLE_NAME"].ToString();
sourceDA = new OleDbDataAdapter("SELECT * FROM [" + excelSheetName + "]", new OleDbConnection(sourceConnString));
sourceDS = new DataSet();
sourceDA.Fill(sourceDS);
The Excel file has been read using Script Task in SSIS 2010
When we view the data set "sourceDS" it turn blank so , no data is available while the user has provided "abc"
please suggest how we can retain all the values and validate and produce the relevant data error to the user