Get sheet name which is in any digit

Hi all,
I have different excels so basically I want to get sheet name so I used getworkbooksheet activity.then I use if condition to get only sheet1 data and I want to write another condition in if like if I have sheet with digits(dynamic) every time so then how to write condition.
Pls suggest

can you show example of your excel with the sheet name?

Var(Boolean)=List_Sheets.Any(Function(s) S.isnumeric)

If
Var
Then
S_Name = List_Sheets.Where(Function(s) S.isnumeric).First()

@Gangadhar_Athili Hi,

Please follow these steps.
1-loop over all sheets.
2-put if condition
3- put condition like this
System.Text.RegularExpressions.Regex.IsMatch(“sheet-name-in-string”, “/[1][A-Za-z0-9](?:_[0-9]+)$/gm”)
4- in then block put all activities you want to do.

Acceptable sheet names are.
Sheet1, sheet2, sheet2431… Like this pattern
Start with alphabets and end with digits


  1. A-Za-z ↩︎

My file is like


Like this or sometimes sheet1 so I want to write if condition like if getsheetname.contains(“sheet1”) or like above digit .else error like sheet not available

@sayali_rokade

Put like this in your If-> condition.

System.Text.RegularExpressions.Regex.IsMatch(getsheetname,“[0-9]”) or getsheetname.contains(“sheet1”)

->Make sure getsheetname is string

Hi,

How about the following?

sheets.Any(Function(s) s="Sheet1" OrElse System.Text.RegularExpressions.Regex.IsMatch(s,"^\d+$"))

Regards,

And what to write in read range …means which sheet I need to put

Sheet_Name=List_sheets.Where(Function(s) s=“Sheet1” OrElse System.Text.RegularExpressions.Regex.IsMatch(s,“^\d+$”)).First()

put…Sheet_Name variable in Sheet Name Property of Read Range.

Hi,

If there is always single target sheet, the following will work.

targetSheet = sheets.Where(Function(s) s="Sheet1" OrElse System.Text.RegularExpressions.Regex.IsMatch(s,"^\d+$")).SingleOrDefault

Regards,