Get Excel Sheet Names
Get Excel Sheet Names
Section titled “Get Excel Sheet Names”Type: excel-get-sheet-names · Package: Excel Activities v1.0.6 · Output: List
Returns a list with the names of every sheet in the file. Useful when you don’t know the sheet names in advance, or when you want to process every sheet of a workbook by looping through them.
How it works
Section titled “How it works”It returns the sheet names in tab order, hidden sheets included. Accepts session or path — see the two modes.
Read-only: in fast mode it does not modify the file.
Required parameters
Section titled “Required parameters”None — but you must set session or path (or be inside the body of an Excel Open).
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanExcelSession | — | Excel Open session (instead of path). |
path | string | — | Path to the .xlsx (required if there is no session). The file must exist. |
Output
Section titled “Output”Returns a List of text values (string) with the sheet names, e.g. ["January", "February", "Summary"]. On a session for a new file where nothing has been written yet, it returns an empty list.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'session' or 'path' is required. | Neither session nor path is set. |
File not found. | path does not exist. Validate first with File Exists. |
Extension 'xls' is not supported. Supported extensions are '.xlsx', '.xlsm', '.xltx' and '.xltm'. | The file is not .xlsx/.xlsm. Convert it first. |
Example
Section titled “Example”Process every sheet of a workbook (with a session, the file is opened only once):
Excel Open path = asset("yearly.xlsx") → output: workbookGet Excel Sheet Names session = workbook → output: sheets
For Each items = sheets itemVariable = sheet └─ activities: Read Excel Sheet session = workbook sheet = sheet → output: data Log message = "Sheet " + sheet + ": " + rowCount(data) + " rows"
Excel Close session = workbook save = falseRelated activities
Section titled “Related activities”- Read Excel Sheet — read each sheet found.
- Get Excel Used Range — dimensions of a sheet.