Match Sheet name with the config text

Suppose I have a text in config. I want to check which sheet name has the text which I have in the config and get the exact sheet name from excel file

@Sana_Afreen Have an excel scope. In properties, create workbook variable as an output.

Then, Check workbook.Getsheets.Contains(TheText).

Hey @Sana_Afreen,

Check this workaround for you :slight_smile:


okay, After that if text exist then how to get that sheet name

which sheet name contains the text

@Sana_Afreen You will have to loop through the Workbook.GetSheets and print item.tostring if the sheetname exists as per the config value. Use below workflow for your reference,

test.xaml (7.2 KB)

@Sugumar8785 In write line it is giving the name of all the sheet even if the text doesnt match

Have you put the textexists in a if condition?

yes @Sugumar8785. I have used exactly what you gave. I only want the sheet name for which the text is match. But it is giving all the sheet name

Inside this WorkBook.GetSheets.Contains(“”) , Have you put text inside the double quotes.

As you said it is config text, you will have to use it instead of quotes.

Yes @Sugumar8785 I have put the text inside quote

Could you take a screenshot and post it here so that I can check what went wrong.

somehow textexists is always true

Config value is Cover

Sorry, My bad. Can you please change the assigned value of TextExists to item.Equals(“YourConfigText”). Updated workflow as below,

test.xaml (8.8 KB)

Hi @Sugumar8785. It is working fine now if I put one of the sheet name as my config text.

But the text can not always be the sheet name. For Example the text is Primary and the sheet name is “Primary Test”. So it will check for the word primary and give the sheet names in which word primary is there

In such cases, you will have change the condition as below,

item.ToString.Contains.toLower((Your Config String).toLower)

So If the particular word exists , it will give you the sheetname

  • If it has helped you , please mark this as a solution. Thanks.

thankyou so much. It worked

1 Like

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