Help Centre › Functions & Formulas
This article describes the RPA Google Workspace connector function to sort a range in a Google Sheet.
For a full list of available functions, please read GOOGLE WORKSPACE functions.
Description
The Sort range function sorts the data in a specified range by one or more columns. The sort modifies the data in place.
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Connector | Yes | Select | - | Select the Google Workspace connector to use |
| Spreadsheet ID | Yes | Text | - | Google Sheets spreadsheet ID |
| Sheet ID | Yes | Text | - | Numeric sheet ID |
| Range | Yes | Text | - | A1 notation range to sort (e.g. A1:D100) |
| Sort specs | Yes | Text | - | JSON array of sort specs, e.g. [{"dimensionIndex":0,"sortOrder":"ASCENDING"}] |
Errors
- Sheet not found – no sheet exists with the given ID
- Invalid sort spec – the sort specification JSON is malformed
Tips
- dimensionIndex is zero-based (0 = column A, 1 = column B, etc.)
- sortOrder can be ASCENDING or DESCENDING
- Exclude header rows from the range to avoid sorting them
Related functions
- Read sheet range – Read values after sorting
- Find in sheet – Search for values