Get Sheetname if condition is True

Hey there,

I would like to get the sheet name and cell address if a value is found.
Can you guide me on how to do it?

Thanks in advance! : )

Hi @WS_Chai

Try this

I hope it helps!!

@WS_Chai

use an if condition and if the data is found then use the below activities to get the sheetname and the cell value.

Hope it works!!

Hi @vrdabberu,

May I know what should i put in “index” of Get workbook sheet activity?

Hi @WS_Chai ,
image

Regards
LNV

@WS_Chai

If there is only one sheet in workbook then use the index value as 0 in get workbook sheet activity.

If there is more than one sheet in workbook then use the for each workbook sheet and then use the currentindex-1 in get workbook sheet activity

Regards

@vrdabberu,

Thank you for your reply, but I would like to only get the sheet name only if a value say “123” exists in a cell in this tab. It may know appear in all sheets. Do I use this approach?

@Nguyen_Van_Luong1 ,

Thank you for your reply, but I would like to only get the sheet name only if a value say “123” exists in a cell in this tab. It may not always appear in the first sheet, shall I still put “0” in the index?

@WS_Chai

Do you know in which cell the value will be present ?

Regards

Hi @WS_Chai ,
I understand that you have an excel file with many sheets.
you want to find the name of the sheet in which there is a cell “123”
that’s right?

if so, you need
read all sheets by index 0…n
check if in data has value “123”
returns sheet index, and sheet name

Regards,
LNV

@WS_Chai

Use Get WorkBook Sheet
Use for each (var sheet in WorkBook_sheets)
Use Find/Replace Activity.
If the content find perform actions
Break

@vrdabberu,

Thanks for the question.
I do not know as the bot will read through a list of files, the value “123” may appear in any sheet and any cell.

@WS_Chai

Try the below flow

sample.xaml (148.0 KB)

Hope it works!!

@WS_Chai

Try the below process

I hope it helps!!

@vrdabberu,

I got this error. How should I resolve it?
Shall I just create a new variable or an assign activity?

@WS_Chai

is that activity placed within the for each excel sheet only?

Regards

@WS_Chai

Try the below flow

sample.xaml (148.0 KB)

Hope it works!!

May I know what does this error mean?

@WS_Chai

Can we connect??

regards

It is the modern activity you cannot provide the object there. you have to pass the handler name with type. like if handler is Excel then Excel.sheet(“Sheet1”) you will get handler here
image

or you can click on plus symboll next to the error there select like


custom input and select sheet.