Get Excel workbook active sheet name without opening file

Like many of you, I also need to get active sheet name from Excel file. There are ways to do that by opening excel, sending hotkeys and grabbing sheet name from clipboard. But maybe there is an elegant way - go get if from excel without opening the file?

Active Sheet - the sheet which is displayed when you open excel file.

Hello @NotFranmax,
You can use Excel Application Scope activity and create an output in it. Then you can use it like in my example:


In ‘GetSheets’ parenthesis you need to put index number of the Sheet (counting from 0).

Thank You @Pablito, but I don’t know the ID of active sheet neither.

@NotFranmax

You can have that in for each loop buddy…!

Kindly have a look at below steps that you can add to your sequence

  1. Excel application scope - get the output of the activity as a workbook type, with name “Out_workbook”

  2. assign activity -
    SheetNameList = Out_workbook.GetSheets.ToList()

  3. For each loop with sheetnamelist as item

Hope this would help you…

Cheers…!

Hello @NotFranmax,

Here is an activity called Get Sheets name. You can get all the sheet name without opening the files.

Here you can download the package.

https://go.uipath.com/component/balareva-xl-activities

Regards
Balamurugan.S

1 Like

Thank You for replies, however the problem is that I need to get an Active sheet name. Not the list of all sheets, but sheet which is visible when you open the file.

1 Like