Liking cljdoc? Tell your friends :D

gsheetplus.core

Low-level Google Sheets API operations: reading ranges, batch updates, sheet management, and URL utilities.

Low-level Google Sheets API operations: reading ranges, batch updates,
sheet management, and URL utilities.
raw docstring

add-sheetclj

(add-sheet service spreadsheet-id title)

Add a new tab with title to spreadsheet-id. Returns the API response.

Add a new tab with `title` to `spreadsheet-id`. Returns the API response.
raw docstring

append-rows!clj

(append-rows! service spreadsheet-id sheet-id data-rows)

Appends rows to a specific sheet using the CellDataValue protocol for precise type encoding — dates are written as serial numbers with number formats, booleans and nils are encoded explicitly, and callers can extend CellDataValue for custom types. Appends after the last non-blank row (determined client-side via a preflight read). Breaks down requests into batches of ~10k cells. If any row is wider than the sheet's current column count, inserts the necessary additional columns first.

data-rows is a sequence of sequences of CellDataValue-compatible values. sheet-id is the numeric sheet ID.

Appends rows to a specific sheet using the CellDataValue protocol for precise
type encoding — dates are written as serial numbers with number formats,
booleans and nils are encoded explicitly, and callers can extend CellDataValue
for custom types. Appends after the last non-blank row (determined client-side
via a preflight read). Breaks down requests into batches of ~10k cells. If any
row is wider than the sheet's current column count, inserts the necessary
additional columns first.

`data-rows` is a sequence of sequences of CellDataValue-compatible values.
`sheet-id` is the numeric sheet ID.
raw docstring

auto-fill-requestclj

(auto-fill-request sheet-id src-start-col src-end-col fill-length)

AutoFillRequest filling from columns [src-start-col, src-end-col) for fill-length columns. 0-based.

AutoFillRequest filling from columns [src-start-col, src-end-col) for `fill-length` columns.
0-based.
raw docstring

copy-toclj

(copy-to service src-spreadsheet-id src-sheet-id dst-spreadsheet-id sheet-title)

Copy sheet src-sheet-id from src-spreadsheet-id to dst-spreadsheet-id. If sheet-title is provided, the new sheet is renamed after copying. Returns the properties of the newly created sheet.

Copy sheet `src-sheet-id` from `src-spreadsheet-id` to `dst-spreadsheet-id`.
If `sheet-title` is provided, the new sheet is renamed after copying.
Returns the properties of the newly created sheet.
raw docstring

copypaste-cols-requestclj

(copypaste-cols-request sheet-id
                        src-start-col
                        src-end-col
                        dst-start-col
                        dst-end-col
                        {:keys [paste-type]})

CopyPasteRequest copying columns [src-start-col, src-end-col) to dst-start-col. options may include :paste-type string. 0-based.

CopyPasteRequest copying columns [src-start-col, src-end-col) to dst-start-col.
`options` may include `:paste-type` string. 0-based.
raw docstring

copypaste-rows-requestclj

(copypaste-rows-request sheet-id
                        src-start-row
                        src-end-row
                        dst-start-row
                        dst-end-row)

CopyPasteRequest copying rows [src-start-row, src-end-row) to dst-start-row. 0-based.

CopyPasteRequest copying rows [src-start-row, src-end-row) to dst-start-row. 0-based.
raw docstring

delete-cols-requestclj

(delete-cols-request sheet-id start-col end-col)

DeleteDimensionRequest for COLUMNS [start-col, end-col). 0-based.

DeleteDimensionRequest for COLUMNS [start-col, end-col). 0-based.
raw docstring

delete-rows-requestclj

(delete-rows-request sheet-id start-row end-row)

DeleteDimensionRequest for ROWS [start-row, end-row). 0-based.

DeleteDimensionRequest for ROWS [start-row, end-row). 0-based.
raw docstring

delete-sheetclj

(delete-sheet service spreadsheet-id sheet-id)

Delete the sheet tab identified by sheet-id from spreadsheet-id.

Delete the sheet tab identified by `sheet-id` from `spreadsheet-id`.
raw docstring

do-with-retriesclj

(do-with-retries {:keys [max-retries retry-delay retryable-error? log-level
                         message context]
                  :or {max-retries 3 retryable-error? (constantly true)}}
                 f)

Options: :max-retries - number of retries (default 3) :retry-delay - nil | [:random-range :min M :max N] | [:random-exp-backoff :base B :+/- J :max M] :retryable-error? - (fn [ex]) → bool; default: any exception :log-level - :info/:warn/:debug/:error (default: nil = silent) :message - string prefix for retry log message :context - map merged into ex-data on final ExceptionInfo failure, or logged alongside plain exception message

Options:
:max-retries      - number of retries (default 3)
:retry-delay      - nil | [:random-range :min M :max N]
                    | [:random-exp-backoff :base B :+/- J :max M]
:retryable-error? - (fn [ex]) → bool; default: any exception
:log-level        - :info/:warn/:debug/:error (default: nil = silent)
:message          - string prefix for retry log message
:context          - map merged into ex-data on final ExceptionInfo failure,
                    or logged alongside plain exception message
raw docstring

exec!clj

(exec! service spreadsheet-id requests)

Execute requests (sequence of Request) as a single batchUpdate. Retries up to 2 times on 429 with exponential backoff. Wrapped in an OTEL span.

Execute `requests` (sequence of Request) as a single batchUpdate.
Retries up to 2 times on 429 with exponential backoff. Wrapped in an OTEL span.
raw docstring

find-sheet-idclj

(find-sheet-id service spreadsheet-id sheet-title)

Return the numeric sheet ID for sheet-title within spreadsheet-id, or nil.

Return the numeric sheet ID for `sheet-title` within `spreadsheet-id`, or nil.
raw docstring

get-cellsclj

(get-cells service spreadsheet-id sheet-range)

Fetch sheet-range from spreadsheet-id, returning rows of raw cell maps. Wrapped in an OTEL span.

Fetch `sheet-range` from `spreadsheet-id`, returning rows of raw cell maps.
Wrapped in an OTEL span.
raw docstring

get-sheet-nameclj

(get-sheet-name service spreadsheet-id sheet-id)

Return the title string for sheet-id in spreadsheet-id, or nil.

Return the title string for `sheet-id` in `spreadsheet-id`, or nil.
raw docstring

gsheet-getclj

(gsheet-get service spreadsheet-id range)

Call spreadsheets.values.get with UNFORMATTED_VALUE render option.

Call spreadsheets.values.get with UNFORMATTED_VALUE render option.
raw docstring

gsheet-get-valuesclj

(gsheet-get-values service spreadsheet-id range)

Return the "values" vec-of-vecs from a gsheet-get response.

Return the "values" vec-of-vecs from a gsheet-get response.
raw docstring

infoclj

(info service spreadsheet-id)

Return the full spreadsheets.get response for spreadsheet-id.

Return the full spreadsheets.get response for `spreadsheet-id`.
raw docstring

insert-data!clj

(insert-data! service
              spreadsheet-id
              sheet-id
              row
              col
              vector-row-data
              &
              [inherit-from-before])

Insert vector-row-data rows at row/col, sending both the insert-rows and update-grid requests in a single exec! call. row and col are 0-based.

Insert `vector-row-data` rows at `row`/`col`, sending both the insert-rows and
update-grid requests in a single exec! call. `row` and `col` are 0-based.
raw docstring

insert-dimension-requestclj

(insert-dimension-request sheet-id dim inherit-from-before start num)

InsertDimensionRequest for dim ("ROWS" or "COLUMNS") starting at start. inherit-from-before controls formatting inheritance. 0-based.

InsertDimensionRequest for `dim` ("ROWS" or "COLUMNS") starting at `start`.
`inherit-from-before` controls formatting inheritance. 0-based.
raw docstring

insert-rows-requestclj

(insert-rows-request sheet-id inherit-from-before start-row num-rows)

InsertDimensionRequest for ROWS before start-row. 0-based.

InsertDimensionRequest for ROWS before `start-row`. 0-based.
raw docstring

(parse-spreadsheet-link url)

Parse a Google Sheets URL into {:spreadsheet-id "..." :sheet-id 123}. Returns nil for nil input.

Parse a Google Sheets URL into {:spreadsheet-id "..." :sheet-id 123}.
Returns nil for nil input.
raw docstring

rate-limit-error?clj

(rate-limit-error? e)

True if e is a Google API 429 (rate limit) response.

True if `e` is a Google API 429 (rate limit) response.
raw docstring

set-hiddenclj

(set-hidden service spreadsheet-id sheet-id hidden?)

Set the hidden property of sheet sheet-id to hidden?.

Set the hidden property of sheet `sheet-id` to `hidden?`.
raw docstring

sheet-infoclj

(sheet-info service spreadsheet-id sheet-id)

Return the raw sheet map for sheet-id within spreadsheet-id, or nil.

Return the raw sheet map for `sheet-id` within `spreadsheet-id`, or nil.
raw docstring

(spreadsheet-link spreadsheet-id sheet-id)

Format a Google Sheets URL for a specific sheet tab.

Format a Google Sheets URL for a specific sheet tab.
raw docstring

try-catch-gsr-exceptionclj

(try-catch-gsr-exception f err-pattern)

Call f. If a GoogleJsonResponseException matching err-pattern is thrown, return true. If f succeeds, return false. Other exceptions re-thrown.

Call `f`. If a GoogleJsonResponseException matching `err-pattern` is thrown,
return true. If f succeeds, return false. Other exceptions re-thrown.
raw docstring

update-cells-requestclj

(update-cells-request sheet-id row-idx col-idx data)

UpdateCellsRequest for a single row of data at [row-idx col-idx]. 0-based.

UpdateCellsRequest for a single row of data at [row-idx col-idx]. 0-based.
raw docstring

update-grid!clj

(update-grid! service spreadsheet-id sheet-id row-idx col-idx data)

Build and execute an update-grid-request. 0-based row/col.

Build and execute an update-grid-request. 0-based row/col.
raw docstring

update-grid-requestclj

(update-grid-request sheet-id row-idx col-idx data)

UpdateCellsRequest for a 2D region starting at [row-idx col-idx]. data is a vec of rows, each row a vec of CellDataValue-compatible values. Indexes are 0-based.

UpdateCellsRequest for a 2D region starting at [row-idx col-idx].
`data` is a vec of rows, each row a vec of CellDataValue-compatible values.
Indexes are 0-based.
raw docstring

update-titleclj

(update-title service spreadsheet-id sheet-id new-sheet-title)

Rename sheet sheet-id to new-sheet-title.

Rename sheet `sheet-id` to `new-sheet-title`.
raw docstring

update-title-with-incrementing-nameclj

(update-title-with-incrementing-name service
                                     spreadsheet-id
                                     sheet-id
                                     sheet-name0)

Rename sheet sheet-id. If name already exists, append .01, .02, etc.

Rename sheet `sheet-id`. If name already exists, append `.01`, `.02`, etc.
raw docstring

with-retriesclj

(with-retries f err-message)

Execute f with default retry options (up to 3 retries). err-message is logged as context on failure.

Execute `f` with default retry options (up to 3 retries). `err-message` is
logged as context on failure.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close