i have a script task in ssis pacakge. Code of the script task :
string xlsPath = Dts.Variables["User::FilePath"].Value.ToString();
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
app.Visible = false;
Microsoft.Office.Interop.Excel.Workbook workbook = app.Workbooks.Open(xlsPath);
Microsoft.Office.Interop.Excel.Worksheet worksheet = workbook.Worksheets[1];
int ColumnIndex = 4;
worksheet.Columns[ColumnIndex].TextToColumns();
worksheet.Columns[ColumnIndex].NumberFormat = "0";
workbook.Save();
workbook.Close();
I am having no problem while running package in VS2015, but when running it through sql agent it is throwing the following error :
Exception from HRESULT: 0x800A03EC.
I am using xls file.