Activate Worksheet by Name

Hi,
I need to a work with a workbook, where there are 4 different sheets created by write range activity during the process.
How can I activate specific worksheet by Name?
As the sequence of worksheet is changed now due to new worksheet added in between.
I used Get Workbook Sheet with index but as the index changed now.
Can I use Get Workbook Sheet by Name?
Please help if anyone having any idea.

@Sanjoy_Kr_Singharoy,

Do you want to read data from that sheets ?

You can read a sheet by its name using the read range activity.

Reading data is good.
But In a process if I need to refer to different sheet different time is there anything so that I can refer sheets by variable instead of referring by name. As I want to set value, formula etc.

Please use this activity to get all the workbook sheet names in the order of Index.

The output of this activity is sheet names.

List(0) - SheetName1 - Index is zero
List(1) - SheetName2 - Index is one

Regards,
Karthik Byggari

@Sanjoy_Kr_Singharoy,

You can use a attached file,

GetSheetsName.xaml (8.3 KB)

Cheers,
Pankaj

I can get the sheet names by Get Workbook Sheets.
But, for example I started the work by 2 sheets only. Later during the process 3 more worksheets added. So, to work on existing sheets should I call each time by name or can I define them as variable. So, even any new sheet being added during process I will be able to call the specific sheet by calling the variable/Name.

My question is can we refer worksheets in Excel Activities as Name and Output as a variable?
Currently same we can do but by Sheet index.

Hi @Sanjoy_Kr_Singharoy

If you know the Sheet name and have already got the workbook from the Excel Application Scope activity.
You can get Sheet index for use like below.

index = workbook.GetSheets.ToList().IndexOf(“Sheet1”)

I hope that will be useful to you.

1 Like

Hi Sanjoy,

If you want to pick sheet name instead of index, then you can follow below steps -

1- Take excel Application scope and in properties window create variable of output ex- WrkBook.
2- Drag drop For Each activity ex - For Each sheet in WrkBook.GetSheets.

Hey @Sanjoy_Kr_Singharoy

You can check an existing old thread:-

Let me know if it works for you or not…

Regards…!!
Aksh

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