The Get all Excel worksheets action will return a list of worksheet names stored in %SheetNames%.
Getting a specific value from the list can be accomplished by using an index. Please note that indexes are 0-based in PAD, so, the first sheet name in the list can be retrieved by using the index 0, the second - by index 1, etc.
So, if you want to write the name of the first sheet somewhere, you should write %SheetNames[0]%.
If you want to write them all, you can use a For each loop and then write the %CurrentItem%, which is a variable created by the For each loop that stores the value of the current iteration.
For example, if you wanted to write the name of each sheet into cell A1 of each sheet, you could do the following:
- Launch Excel to open the document
- Get all Excel worksheets
- For each worksheet in %SheetNames%, store the current item into %CurrentItem%
- Set active Excel worksheet using %CurrentItem% as the Name of the sheet
- Write to Excel worksheet writing %CurrentItem% into row 1 column A
- Close Excel saving the file
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.