Assigning multiple values to a variable

Hi. I have an excel file. There are many pages in this excel file. Based on the page names, it can be understood whether the data is related to Football or Basketball. With the Get sheets activity, I output these sheet names to a printout named list_Sheets. Then, I call these pages one by one in the if activity. What I want to do is this: Create a condition similar to currentSheet=BasketballData in the If activity. I don’t want to write a separate equation for each page. Can Switch activity help with this? If possible, how could it happen?

Yes, switch activity is recommended for this scenario

In switch activity change the input type to string then pass for it currentSheet.ToString

Add as case the name of the sheets

You can use the Switch activity in UiPath to handle different cases based on the sheet names. Here’s how you can achieve this:

Get Sheets Activity:

Use the “Get Sheets” activity to get the list of sheet names and store them in a variable (e.g., list_Sheets).
Switch Activity:

Add a “Switch” activity to your workflow. Drag it from the activities panel to your workflow.
Configure Switch Activity:

In the Switch activity, use the expression currentSheet (or whatever variable holds the current sheet name).
For each case, enter the expected sheet names (e.g., “FootballData”, “BasketballData”).

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.