Everybody knows that if you want to obtain the names of excel sheets you have to use Excel application scope, get the wb as variable and then wb.GetSheets.
BUT!
If you don’t have excel installed this will cause an exception.
SO…
How can we read the excel sheets with Invoke code activity and vb.net without office installed?
Somebody has an example?
Dim xlApp As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application()
Dim excelBook As Microsoft.Office.Interop.Excel.Workbook = xlApp.Workbooks.Open("D:\Book1.xlsx")
Dim excelSheets As String() = New String(excelBook.Worksheets.Count - 1) {}
Dim i As Integer = 0
For Each wSheet As Microsoft.Office.Interop.Excel.Worksheet In excelBook.Worksheets
excelSheets(i) = wSheet.Name
i += 1
Next