How to get sheets from Excel or check if sheet name exist

I need to do something (e.g. inside If sheet.name(“sheet3”) condition is true). How Can I get sheet name from my excel file?
P.S. Modern design experience mode…

@vlast

Welcome to forums

Use Excel Application scope and give the path of the excel file

Now use Get Sheets activity and declare a variable

Use For Each activity and change the type argument to String and pass the variable you created in Get Sheets activity

Inside For Each use If condition and write as Item.ToString = “Sheet3”

Then-> Place a Messagebox and True
Else → Place a Messagebox and False

Hope this will help you

Thanks

@vlast

If you want to break the loop once the condition is true then

You can place the break activity

Hope this will help you

Thanks

As I know Use Excel Application scope does not exist in Modern

Provide sheet name as you want to exist in if condition that particular sheetname exist or not

2 Likes

I have Excel Process Scope instead Excel App Scope. Do you know solution for modern?

use this with latest

Thanks.
One more question.

Why if I search For Each Excel Sheet Activity it exist but does not exist in Workbook without searching ?

P.s. Hope you understand what I talking about. Forum does not allow me posting screenshots :confused:

use snip tool and paste it and send it to me

Are You mean use ctrl+C & ctrl+V to paste image? It`s not work too

*This also doesn’t work
(Can’t find edit button)

Can you ping me on my mail: sg2070156@gmail.com

Thanks. No need more. Also I found how get current sheet use code:
Excel.SelectedSheet() it return current sheet.
Also Excel.Sheet is IWorksheetIndexer. Interesting, how I can use it to return sheet what I need something like this?

var sheet = Excel.Sheet.Select(x=> x.Name=="sheet3")

where it can be represented to Assign activity

ok great

I am facing this issue can you please help me Vlast

what buddy? tell me

Hi, the solution of @Sagar_Gupta1 is almost complete. Just change the condition to CurrentSheet.Name.ToString instead of CurrentSheet.ToString :slight_smile: