Filter excel by sheet index

I need my filter not to be based on the worksheet name but on its index. in this case Sheet1 would have the index “1” for me to put sheetname.

I need this because the same filter is performed on several excel files but the name of the worksheet changes

Could you please provide more details?

Hi @gustavo.souza ,

Refer the following thread to know how to get the sheet names from excel file, and then you can use the sheet accordingly:

Regards,

@gustavo.souza

You have two options

  1. Use classic activity(This allows you to specify sheetnumber).to enable - Activities → Filter Icon → Classic
    image
  2. Ideally in the for each sheet in excel activity the sheet are retrieved in the same order as their index so you can use that as well, Where inside for loop you can use if condition with currentindex and also index here starts from zero
    image

cheers

1 Like

Yes, I’ve tried this, but I can’t use the output of the get sheet workbook in the filter activity

@gustavo.souza

Once you get the sheetname you have to use like this Excel.Sheet(varsheetname)

cheers

1 Like

Returned the following error: Sheet name is null or is empty.

The output variable of get workbook sheet is “Planilha”

@gustavo.souza

I guess there is only one sheet can you give index as zero(0)…

cheers

There is more than one worksheet, I changed it to 0 to test and it also gave the same error

@gustavo.souza

Can you please check the variable properly are there two variables created ? And can you please uncheck the template

because I can clearly see the sheetname

cheers

1 Like

it worked thank you very much

1 Like

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