Excel application to find a particular sheet name

Hi,

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”

image

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: List<T>.Contains(T) Method (System.Collections.Generic) | Microsoft Learn

Cheers!

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