How to move between hundreds of worksheets, one by one?

I tried a method but it has some flaws…

What I had done was to build an index with the names of all worksheets (using VBA)

So UIPath would copy (from the index) the name for worksheet in A1 to a variable, then do it’s activities like ReadRange or ReadCell using that name in the field SheetName. After that, it would move down one row in the index sheet, copy the name of 2nd worksheet, etc…

But… it seems a few worksheets, among over 950, have spaces in their names.

And the VBA method does NOT copy the space. So worksheet "617 " became “617”… and when UIPath copies “617” to the variable and then tries to find it, it does not find any such worksheet (because the true worksheet name is "617 ".

Any suggestion on a best approach to this problem?

1 Like

Just a suggestion, use try catch activity and pass the value which VB code read for the first time, if it throws the error, then in the catch block, pass the value appending space to it so that it will recognize the sheet

1 Like

@Rogerio_Penna,

Try to use UiPathTeam.Excel.Extensions.Activities, it has some good features to do this task.

Hi, use excel application scope and get sheets activity
It will give you the sheets list
Now use
For each loop
Inside for each loop
Use
Read range
At the sheet input give value as ‘item’

1 Like