Definition and Usage
Get worksheet names command retrieves the name(s) of worksheet(s) from an Excel file. This command allows you to extract either the current active worksheet name or all worksheet names from a specified Excel instance, which can be useful for navigation, validation, or reporting purposes in your automation workflow.
Parameter Values
Input parameters
Parameter | Description | Possible Values | Required | Options / Notes |
Excel instance | Please select an Excel instance to identify the instance to operate on | - | Yes | Must be created via the "Launch Excel" or "Get active Excel worksheet" command |
Target worksheet(s) | Get the name of the current worksheet or all worksheets | Current worksheet, All worksheets | Yes | - |
Store worksheet name into | Store the worksheet name in a custom variable | - | Yes | Output variable that will contain the worksheet name(s) |
Error handling
Parameter Name | Description |
Throw error & stop | When an error occurs, the action will trigger an error and stop the execution of the entire app. |
Retry command | If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process. |
Ignore error & continue | When an error occurs, the action will be ignored, and the workflow will continue without interruption. |
Variables produced
This action produces a variable that stores the worksheet name(s). When "Current worksheet" is selected, it returns a string with the name of the active worksheet. When "All worksheets" is selected, it returns an array containing all worksheet names in the Excel file.
Using Variables in Conditions
You can use the output variable (worksheet name) in subsequent actions by referencing it with the {x} syntax. This is particularly useful for:
Conditional logic to check if a specific worksheet exists
Displaying worksheet names in reports or logs
Using worksheet names as parameters in other Excel operations
Notes
Before using this command, ensure that a valid Excel instance has been created and is open.
If the Excel file has no worksheets or the instance is invalid, an error will be thrown.
When retrieving all worksheet names, the order of names in the resulting array corresponds to the order of worksheets in the Excel file.
This command only retrieves worksheet names and does not modify any Excel content.