I'm Trying to Delete some range(A2:BC2000) of Content on Excel using Script task on SSIS, or do you guys gave any alternate methods. Here is the code that i used
Public Sub Main()
Dim Wexcel As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application()
Dim Wb As Workbook = Wexcel.Workbooks.Open("C:\Users\Shawn\Documents\Depart.xlsx")
Dim wf As WorksheetFunction = Wexcel.WorksheetFunction
Dim sheet As Worksheet
For Each sheet In Wexcel.Worksheets
If wf.CountA(sheet.Range("A2:BC20000").Value) > 0 Then
Wexcel.DisplayAlerts = False
sheet.Delete()
Wexcel.DisplayAlerts = True
End If
Next sheet
Dts.TaskResult = ScriptResults.Success
End Sub
if i run my package with this scripttask i'm getting an error below
Can anyone has solution to this??