How Can I count how much sheets there are in workbook?

I’m trying to count how much sheets there are in workbook, but I could not find a way to do that, I’m using a for each into “Excel Process Scope >> Use Excel File >> for Each”, also I tried to use “For each Excel Sheet” but for some reason the system capture only 1 sheet.

The activity Gets Workbook sheets there is not available to use this version that I’m using.
I Already tried find a solution here, but I only found old solutions with old package versions.
Also, the package version I’m using is UiPath.Excel.Activities >=3.0.1

@jhosephjps,

Make sure you selected the classic folder filter and search the Get Workbook Sheets activity

Use it like this. lstSheets.Count will give you sheet count.

1 Like

Hi @jhosephjps

Try Excel Application Scope and inside add -Get Workbook Sheets activity to get the list of sheets.

Then use writeline - sheetsList.Count.ToString

where sheetsList is the output variable from get workbook sheets activity.

1 Like

It worked.
Thank you!!

1 Like

I did it that worked.
Thanks!!

@jhosephjps,

Glad to hear that! Kindly close the thread by marking my answer as solution so it will be helpful to other community members as well! Cheers!

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