unable to update the first cell in the excel worksheet using C# code in SSIS

女生的网名这么多〃 提交于 2020-01-06 04:57:26

问题


the following code was used in a execute script task of ssis package based on c# 2017 language used the following code which was taken from this answer

Application excelApplication = new Excel.Application
            {
                Visible = true,
                ScreenUpdating = true
            };
            string filename;//= Dts.Variables["User::filename"].Value.ToString();
            filename = @"D:\Sundeep\2019\01082019\VersionWithDummyData\finbalReviewTest.xlsx";
            _Workbook workbook = excelApplication.Workbooks.Open(filename);
            _Worksheet sheet = workbook.Worksheets[1];
            Dts.TaskResult = (int)ScriptResults.Success;

When i try to execute the logic I'm getting the following error

Error at updating the first cell: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
Error at updating the first cell: There were errors during task validation.

My requirement was to update the first cell(A1) in a sheet(sheet name:test_update) of excel with "hello world!"

Thanks in advance

来源:https://stackoverflow.com/questions/54106719/unable-to-update-the-first-cell-in-the-excel-worksheet-using-c-sharp-code-in-ssi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!