
Where am i doing wrong?
Just replace first 2 lines with:
Dim excel As Application = New Microsoft.Office.Interop.Excel.Application
Dim workBook As Microsoft.Office.Interop.Excel.Workbook = excel.Workbooks.Open("YourPathToExcelFile")
You have 2 different types named ‘Application’ and ‘Workbook’.
UiPath does not know which one has to choose
We have to clarify from which namespace we want to use that types.
After changing ‘Application’ to full object name ‘Microsoft.Office.Interop.Excel.Application’ error should disappear. Its good to remember what this error means
When you say table, do you mean sheets - the tabs at the bottom of the Excel file? This will get a list of them:
It does not give an error, but there is no data in the list.
Have you ever tried the code? Does it work?
No, it’s not the sheet names I want to ask.
I am trying to find the table names contained in the Excel file.
Hi @ekseri ,
Make sure you have given the Direction of the list argument as Out
in Invoke Code
Activity.
Hi can you help me for that please share the workflow I am facing some error
Dim excel As Application = New Microsoft.Office.Interop.Excel.Application
Dim workBook As Microsoft.Office.Interop.Excel.Workbook = excel.Workbooks.Open(“C:\Users\Aleem Anwar\Documents\UiPath\get all name of table\files\1.xlsx”)
Dim workSheet As Worksheet
Dim excelTable As ListObject
listOfTableNames = New List(Of String)
For Each workSheet In workBook.Worksheets
For Each excelTable In workSheet.ListObjects
listOfTableNames.Add(excelTable.Name)
Next excelTable
Next
excel.Quit
I have two table in excel and I need to find all name using this code.Please help me where I am wrong
Main.xaml (10.5 KB)
I would avoid dim-ing a variable with the same name as the type.
Seems like error related to excel library.
I have never seen this.
Maybe try to install Microsoft.Office.Interop.Excel nuget
I have imported this package from import tab
You don’t install packages from the import tab. You use the Manage Packages button at the top.
That screenshot doesn’t show us what the error message is. Give us the first few red lines in your Output (in other words, scroll up to the beginning of the error)
Did you change workSheet to something else? Let’s rule that out as the problem. You have a variable named the same as its type.
As I mentioned in topic with word application:
try to use this repair tool:
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.