In Excel, Iterate Through Each Sheet, Then Through Each Row

Hello,

I have 5 tabs in an Excel worksheet named by states (“CA”, “FL”, “GA”, “MN”, “NC”).

I have a main.xaml where I can open an excel file reference as “Zips”, and For Each CurrentRow In range Zips.Sheet(“CA”) iterate through the CA tab. I then have the whole DO sequence copied four more times, once for each state. Zips.Sheet(“FL”) and so on.

What I can seem to figure out is how to make the sheet names a variable that can be used in the CurrentRow range, if that’s what needed.

Or is there another approach?

Essentially I want to iterate through all Worksheets in a workbook and perform a For Each CurrentRow function on each Worksheet.

Any ideas?

Thanks.

Brett

Hi,

Hope the following helps you.

If there are no sheet except the 5 states, we can also use ForEachExcelSheet instead of ForEach

Regards,

1 Like

Exactly what I needed, thank you. I have a hard time distilling the right question to ask when searching for this on my own. Very grateful for your help.

I am using UIPath Studio and can’t find the “For Each Excel Row” or “For Each Excel Sheet” activities.

How do I add those activities in Studio? When I search for them or look for them in the Activities tab, they are not there.

Thanks.

Brett

Hi,

Which version of Excel.Activities package do you use?

The latest 2.11.3 includes these activities. Can you try to update, if possible?
And you might need to tune filter settings of activity panel in classic design mode as the following .

Regards,

1 Like

I didn’t have the correct package. Thanks again!

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