Google Sheets — Write range
Google Sheets — Write range
Section titled “Google Sheets — Write range”Type: googlesheets-write-range · Package: Google Sheets Activities v1.0.5 · Output: —
Writes values starting at a given cell, overwriting whatever is there. Use it to place data at an exact position: fill an area of a template or drop a table below fixed titles.
How it works
Section titled “How it works”Writes values starting at the top-left cell of range, in the sheet sheet (the first one if empty), in a single call to Google:
- Accepts a DataTable (all its rows) or a DataRow (a single row). Only the values are written, never the column names.
- Values are interpreted as USER_ENTERED (formulas, numbers and dates as if you typed them).
- It overwrites the cells the table covers; anything outside that area is untouched. If the new data is shorter than the old data, clear it first with Clear range.
- If you give a range (
A2:C10) instead of one cell, it must be at least as large as the data; with a single cell (A2) the table extends as far as needed.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
range | string | — | Start cell or range to write to, e.g. A1, B3. |
values | DataTable | DataRow | — | The data to write (values only, no headers). |
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. The log shows how many cells were updated.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'range' is required. | range is empty or its expression returned null. |
'values' is required. | values is empty or its expression returned null. |
'values' must be a DataTable (or a single DataRow). | A list, text or another type was passed. Build the table with Build DataTable. |
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”Write a title row and the data below it:
Build DataTable columns = arr("c1", "c2") rows = arr(arr("Customer", "Total")) → output: titlesGoogle Sheets — Write range session = book range = "A1" values = titlesGoogle Sheets — Write range session = book range = "A2" values = dataRelated activities
Section titled “Related activities”- Write sheet — write from A1.
- Write cell — write one cell.
- Append rows — append at the end.