Custom Script To Switch Between Excel Tabs

Has anyone created a custom script to switch between sheets within an Excel document using sheet index with variable input?
Specifically, my project requires opening an Excel document, navigating to each sheet in the document, and performing various operations on the sheet’s contents. The built in ‘Switch to sheet’ action in the RPA Express Recorder will not work for this project, I am unable to use ‘Specify Index’ because there will be a variable number of sheets and the action does not accept variables as an input, and I am unable to use ‘Specify name’ because the sheets will have inconsistent naming conventions.
In essence I am trying to figure out a Custom Script that functions exactly like the ‘Switch to Sheet’ action, using the ‘Specify index’ setting, but accepts a variable as its input.

Thanks, everyone!
-Ethan Morris
RPath RPA Manager

The RPAE support team really helped me out on this one, providing a sample script that reads all tab names in an excel document to a list variable (thus allowing you to iterate through them by name which does accept variables. I’ve attached a copy for anyone else who may be running into the same issue.

Excel Tab (1.5 KB)

-Ethan Morris
RPath RPA Manager


Thanks for sharing!

Thanks! This should be made standard option