Skip to content

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.

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.
ParameterTypeDefaultDescription
rangestring—Start cell or range to write to, e.g. A1, B3.
valuesDataTable | DataRow—The data to write (values only, no headers).
ParameterTypeDefaultDescription
sessionZoanGoogleSheetsSession—Session from Google Sheets — Open. Inside Open’s body it is inherited and you can leave it empty.
sheetstring—Sheet name. If empty, the first sheet is used.

This activity does not return a value. The log shows how many cells were updated.

MessageCause 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.

Write a title row and the data below it:

Build DataTable columns = arr("c1", "c2") rows = arr(arr("Customer", "Total")) → output: titles
Google Sheets — Write range session = book range = "A1" values = titles
Google Sheets — Write range session = book range = "A2" values = data