Google Sheets — Get sheet names
Google Sheets — Get sheet names
Section titled “Google Sheets — Get sheet names”Type: googlesheets-get-sheet-names · Package: Google Sheets Activities v1.0.5 · Output: List<string>
Returns the list of sheet names in the document. Useful when you do not know their names in advance, to check that a sheet exists before using it, or to process every sheet in a loop.
How it works
Section titled “How it works”Asks Google for the tab names of the document opened in the session and returns them in tab order. It only reads the names, not the data, so it is a light call.
Required parameters
Section titled “Required parameters”None.
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGoogleSheetsSession | — | Session from Google Sheets — Open. Inside Open’s body it is inherited and you can leave it empty. |
Output
Section titled “Output”Returns a List of string with the sheet names, in tab order (the first one is what the other activities use when sheet is empty).
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No Google Sheets session available. Provide 'session' from a googlesheets-open activity, or place this activity inside the Open activity's body … | The activity is outside Open’s body and received no session. Move it inside the body or pass the saved session. |
The service sheets has thrown an exception. HttpStatusCode is … | Google rejected the call: missing sheet or range, no access, expired token or quota exceeded. See Google API errors. |
Example
Section titled “Example”Google Sheets — Get sheet names session = book → output: namesFor Each items = names itemVariable = s └─ activities: Google Sheets — Read sheet session = book sheet = s has-headers = true → output: data Log message = s + ": " + rowCount(data) + " rows"Related activities
Section titled “Related activities”- Read sheet — read each sheet.
- Used range — size of a sheet.