JeffNZ1
(Jeff Shum)
August 2, 2021, 4:25am
1
Hi,
I’m using an IF activity to find out if the data scraped excel sheet name is like “BP” or not . If the sheet name is BP then the robot will perform some actions else it will perform something else. Before the IF activity I used a Get Full Text activity to extract the sheet name as a string variable. I’ve confirmed that the extracted value is “BP” so I don’t understand why the sheet name variable condition in the IF activity is failing as it always goes down the else path.
Regards,
Jeff
Yoichi
(Yoichi)
August 2, 2021, 4:31am
2
Hi,
First, can you try the following step to check content of SheetName variable?
Set break point at If activity.
Run Debug or Debug File.
It will stop at If activty. Then check content of SheetName variable at Locals panel.
Regards,
Hi @JeffNZ1 ,
You can also use log message activity to print value of get full text before If condition.
First of all debug and check the SheetName value in runtime.
Use below method in the if condition-
SheetName.Trim.Contains(“BP”)
As you are using Get Full text method its more prone to get junk values along with “BP”.
postwick
(Paul Ostwick)
August 2, 2021, 1:49pm
5
You should be using Get Workbook Sheets to get the sheets (and their names).
UiPath.Excel.Activities.ExcelGetWorkbookSheets Returns a list of all the sheet names in a workbook as String variables, ordered by their index. Properties Common DisplayName - The display name of the activity. Misc Private - If selected, the values...
2 Likes
Hi @JeffNZ1 ,
As @postwick suggestion you can use Get workbook sheet
Get workbook sheet → Create a Variable(Type : List of String)
For Each item in Variable(Type : List of String)
If item = “BP” then your process else other process
JeffNZ1
(Jeff Shum)
August 2, 2021, 11:43pm
7
Thanks Paul appreciate the advice cheers
system
(system)
Closed
August 5, 2021, 11:44pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.