Google Sheets — Clear range
Google Sheets — Clear range
Section titled “Google Sheets — Clear range”Type: googlesheets-clear-range · Package: Google Sheets Activities v1.0.5 · Output: —
Clears the content of a range of cells. Useful to wipe old data before writing new data, so no stale rows are left below. It removes only the values (and formulas), not the formatting: colors, borders and widths are kept.
How it works
Section titled “How it works”Empties the cells of range in the sheet sheet (the first one if empty) with one call to Google. Clearing a range that is already empty is not an error. The change is immediate and cannot be undone from the robot (it can from the sheet’s version history).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
range | string | — | Range to clear in A1 notation: A1:Z100, A:Z (whole columns), 2:1000 (rows). |
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. |
sheet | string | — | Sheet name. If empty, the first sheet is used. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'range' is required. | range is empty or its expression returned null. |
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”Clear the data (keeping the titles in row 1) and write it again:
Google Sheets — Clear range session = book sheet = "Results" range = "A2:Z"Google Sheets — Write range session = book sheet = "Results" range = "A2" values = freshRelated activities
Section titled “Related activities”- Write sheet — write new data.
- Used range — see which area has data.