0

I have a case where I need to read an excel file with filtered rows using SSIS.

I've started testing the process but all I get when I look in my table is "System.__ComObject"

I'm sure I doing something stupid.

Thanks

Public Overrides Sub CreateNewOutputRows()

Dim xlApp = New Excel.Application

Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim rw As Excel.Range
xlApp.DisplayAlerts = False

wb = xlApp.Workbooks.Open("C:\PosData\test.xlsx")


Dim visible As Excel.Range = wb.Sheets("Data").UsedRange.SpecialCells(Excel.XlCellType.xlCellTypeVisible, Type.Missing)
For Each rw In visible.Rows
    Output0Buffer.AddRow()
    Output0Buffer.Column = rw.Cells(1, 1).ToString
Next

Output0Buffer.SetEndOfRowset()
End Sub
1
  • 1
    A practice I find helpful when debugging SSIS Script Tasks is to take the core logic and copy it into a .NET Console App so that I can step through and inspect the values. SSIS 2012 allows for setting breakpoints in dataflow scripts but in my mind it's still not as efficient as a full blown project. That said, shouldn't ToString be ToString()? Commented May 8, 2013 at 15:42

1 Answer 1

1

That happens sometimes when using the Interop. All objects from Excel, in this case, are indeed COM Objects.

Use Cells(1,1).Value or Cells(1,1).Value2 or Cells(1,1).Text. Wich fits best for you. (Maybe you need to Cast or Convert the Cells to Range first)

Sign up to request clarification or add additional context in comments.

1 Comment

That was it. I was frustrated by the lack of properties appearing on the end of the cells.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.