How to get the sheet with dynamic sheet name

Hi all,

I am trying to build a RPA with a for each file loop on excel file to get values from particular cell.
However, the sheet name is dynamic for each excel file, but all the excel files only contain 1 sheet at all.
May I know how to write the command to get the exact cell value from the sheet for each excel file? (I am using the excel process scope for processing)

image

Many thanks in advance !

Hi

Welcome to uipath forum

Hope the below steps would help you resolve this

this can handle one sheet or multiple sheet

  1. Use a excel application scope and pass the filepath as input

  2. From that scope itself we can get a output variable named out_workbook which is of type workbook

  3. Now use a FOR EACH activity where pass the above variable out_workbook.GetSheets as input
    And change the type argument as string
    In property panel

  4. Inside the loop use a READ CELL activity where mention the sheet name as item and mention the cell position from where you want the value and get the output as string variable

That’s it

Try using a message box if you would like to see the sheet names

Cheers @Wilfred_Hung

Hi,

If there is always only one sheet in each Excel workbook, the following will work.

Regards,

1 Like

Thanks, guys !
Both can work !

1 Like

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