Pure builders for spreadsheets.batchUpdate requests. Each returns
one request Map; pass a Vec of them to
::google::sheets::spreadsheets/batch-update, which applies them
atomically in order.
Ranges are GridRanges with 0-based, end-exclusive indexes on a
numeric sheetId (not the title; see
::google::sheets::spreadsheets/sheet-id). Build one with
grid-range.
::req ::google::sheets::requests
header ::req/grid-range(0, 0, 1)
::google::sheets::spreadsheets/batch-update(id, [
::req/freeze(0, 1),
::req/bold(header),
::req/background(header, ::req/hex-color("#e8f0fe")),
::req/auto-resize(0, "COLUMNS")
])
Values
DIMENSIONS
DIMENSIONS: Vec [
"ROWS",
"COLUMNS"
]
Functions
add-sheet
fn (title: Str): Map
fn (title: Str, opts: Map): Map
addSheet: a new tab titled title. Options: index (position), rowCount, columnCount, frozenRowCount, sheetId (choose the id), hidden.
append-dimension
fn (sheet-id: Int, dim: Str, count: Int): Map
appendDimension: add count empty rows (or columns) at the end of a sheet.
auto-resize
fn (sheet-id: Int, dim: Str): Map
fn (sheet-id: Int, dim: Str, start: Int?, end: Int?): Map
autoResizeDimensions: fit "COLUMNS" (or "ROWS") to their content, all of them or start to end (0-based, exclusive).
background
fn (range: Map, color: Map): Map
Fill range with color (from rgb or hex-color).
bold
fn (range: Map): Map
Make range bold (only textFormat.bold changes).
delete-dimension
fn (sheet-id: Int, dim: Str, start: Int, end: Int): Map
deleteDimension: delete rows (or columns) start to end.
delete-sheet
fn (sheet-id: Int): Map
deleteSheet: remove a tab and its data.
dimension
fn (value: Str): Str
dimension-range
fn (sheet-id: Int, dim: Str, start: Int?, end: Int?): Map
A DimensionRange: rows or columns start (inclusive) to end (exclusive) of sheet-id; null bounds are open.
duplicate-sheet
fn (sheet-id: Int, new-title: Str): Map
fn (sheet-id: Int, new-title: Str, opts: Map): Map
duplicateSheet: copy a tab within the spreadsheet as new-title (inserted after the source unless opts.index).
format-fields
fn (format: Map): Str
The fields mask for a userEnteredFormat Map (pure): {textFormat: {bold: true}, backgroundColor: ...} gives "userEnteredFormat(textFormat,backgroundColor)", so other formatting is left alone.
freeze
fn (sheet-id: Int, rows: Int): Map
fn (sheet-id: Int, rows: Int?, columns: Int?): Map
updateSheetProperties freezing the first rows rows (and columns columns when given). 0 unfreezes. Only the counts you pass are changed.
grid-range
fn (sheet-id: Int): Map
fn (sheet-id: Int, start-row: Int?, end-row: Int?): Map
fn (sheet-id: Int, start-row: Int?, end-row: Int?, start-column: Int?, end-column: Int?): Map
A GridRange on sheet-id (0-based, end exclusive; null leaves a side unbounded): grid-range(0, 0, 1) is the first row; grid-range(0, 1, null, 2, 4) is columns C:D from row 2 down.
header-row
fn (sheet-id: Int): Vec
fn (sheet-id: Int, color: Map?): Vec
The usual header treatment as a Vec of requests: freeze row 1 and make it bold (and fill it with color when given).
hex-color
fn (hex: Str): Map
A Sheets Color from a hex string ("#1a73e8" or "1a73e8"); an Err for anything else.
insert-dimension
fn (sheet-id: Int, dim: Str, start: Int, end: Int): Map
fn (sheet-id: Int, dim: Str, start: Int, end: Int, inherit-from-before: Bool): Map
insertDimension: insert empty rows (or columns) at start up to end, inheriting formatting from the row before unless inherit-from-before is false.
number-format
fn (range: Map, format-type: Str): Map
fn (range: Map, format-type: Str, pattern: Str?): Map
Apply a number format: format-type is NUMBER, CURRENCY, PERCENT, DATE, TIME, DATE_TIME, SCIENTIFIC or TEXT; pattern is optional (e.g. "#,##0.00", "yyyy-mm-dd").
rename-sheet
fn (sheet-id: Int, title: Str): Map
updateSheetProperties setting a tab's title.
repeat-format
fn (range: Map, format: Map): Map
fn (range: Map, format: Map, fields: Str): Map
repeatCell applying format (a CellFormat: textFormat, backgroundColor, horizontalAlignment, numberFormat, wrapStrategy, ...) to every cell of range. Only the top-level format fields you give are changed; pass fields to set the mask yourself.
rgb
fn (red: Int, green: Int, blue: Int): Map
A Sheets Color from 0-255 channels: rgb(26, 115, 232) is {red: 0.1019..., green: 0.4509..., blue: 0.9098...}.
set-size
fn (sheet-id: Int, dim: Str, start: Int, end: Int, pixels: Int): Map
updateDimensionProperties setting the pixel width of columns (or height of rows) start to end.