Excel application to find a particular sheet name


I have an excel file in which there are 3-4 sheets. The robot is suppose to find 2 particular sheet name from it. The sheet name to be find is “Primary” and “Secondary”

Get Workboook Sheets Activity returns List of sheet names
Then you can check if List contains “Primary” and “Secondary”


Like this?

Hello @Sana_Afreen :wave:

You don’t have to use a for loop for this. You can simply make use of the .contains method to check if your sheet name exists in the list that the Get Workbook Sheet activity returns.

References: https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.contains?view=net-5.0


Just use If. You can set condition like
Sheets.Contains(“Primary”) AND Sheets.Contains(“Secondary”)
It checks if there are both primary and secondary sheet.

Also I want to get the Sheet number like if primary sheet is found then what is the sheet number

Then You can check Sheets.IndexOf(“Primary”) to check both presence and index
Index starts from 0 and if there’s no “Primary”, it returns -1

Suppose I have a text in config. What I want to do is I want to check which sheet name has the text which I have in the config and get the exact sheet name

please help