High-level table reading and data parsing for Google Sheets. Builds on gsheetplus.core (raw cell reads) and gsheetplus.cell (type conversion).
High-level table reading and data parsing for Google Sheets. Builds on gsheetplus.core (raw cell reads) and gsheetplus.cell (type conversion).
(->kebab-keyword s)Convert a column header string to a kebab-case keyword. Drops parenthetical annotations: 'First Name (optional)' → :first-name
Convert a column header string to a kebab-case keyword. Drops parenthetical annotations: 'First Name (optional)' → :first-name
(blocks raw-data block-titles)Split raw-data into contiguous blocks identified by a marker string in
column A. block-titles is a seq of expected marker strings in order.
Rows before the first block are discarded. The title row is the first row of
each returned block.
Split `raw-data` into contiguous blocks identified by a marker string in column A. `block-titles` is a seq of expected marker strings in order. Rows before the first block are discarded. The title row is the first row of each returned block.
(drop-after-stop-row raw)Truncate rows at the first row where column A = "/STOP".
Truncate rows at the first row where column A = "/STOP".
(fill-down keys-to-fill required? records)For each key in keys-to-fill, propagate non-blank values from the previous
record to any record with a blank value for that key.
required? — when true, throws if a fill key has no value to propagate from.
For each key in `keys-to-fill`, propagate non-blank values from the previous record to any record with a blank value for that key. `required?` — when true, throws if a fill key has no value to propagate from.
(headers-from-row headers-raw
&
[{:keys [column-name-fn keep-leading-blanks]
:or {column-name-fn ->kebab-keyword}}])Parse a raw header row (vector of string-or-nil) into a vector of keywords. Options: :column-name-fn - fn to convert header strings (default ->kebab-keyword) :keep-leading-blanks - when true, preserve leading nil headers for alignment
Parse a raw header row (vector of string-or-nil) into a vector of keywords. Options: :column-name-fn - fn to convert header strings (default ->kebab-keyword) :keep-leading-blanks - when true, preserve leading nil headers for alignment
(info-params raw-data)Extract leading Name-Value pairs from a vec-vec sheet (as from raw-data). Reads rows until the first blank in column A. Returns [info-map remaining-rows start-row-idx].
Extract leading Name-Value pairs from a vec-vec sheet (as from raw-data). Reads rows until the first blank in column A. Returns [info-map remaining-rows start-row-idx].
(prune-start-rows raw)Drop rows up to and including the first row where column A = "/START".
Drop rows up to and including the first row where column A = "/START".
(raw-data service spreadsheet-id sheet-title-or-range)Read the sheet as vec-of-vecs, truncating at /STOP if present.
Read the sheet as vec-of-vecs, truncating at /STOP if present.
(read-as-vec-vec service spreadsheet-id sheet-title-or-range)Read sheet-title-or-range from spreadsheet-id as a vector of vectors
of Clojure values (cell->clj applied to each cell).
Read `sheet-title-or-range` from `spreadsheet-id` as a vector of vectors of Clojure values (cell->clj applied to each cell).
(read-single-table service gsheet-url options)(read-single-table service spreadsheet-id sheet options)Read a Google sheet as a sequence of records (maps keyed by header keywords).
sheet can be a sheet title string, a numeric sheet-id, or a full gsheet URL.
Options: :column-name-fn - header string → keyword (default ->kebab-keyword) :prune-start? - drop rows before /START marker :drop-rows - drop the first N rows :filter-fn - keep only records matching this predicate :row-idx? - add ::core/row-idx (1-based) to each record :stop-on-blank-row? - stop at the first all-blank record
Returns sequence with :headers metadata. Throws on duplicate headers.
Read a Google sheet as a sequence of records (maps keyed by header keywords). `sheet` can be a sheet title string, a numeric sheet-id, or a full gsheet URL. Options: :column-name-fn - header string → keyword (default ->kebab-keyword) :prune-start? - drop rows before /START marker :drop-rows - drop the first N rows :filter-fn - keep only records matching this predicate :row-idx? - add ::core/row-idx (1-based) to each record :stop-on-blank-row? - stop at the first all-blank record Returns sequence with :headers metadata. Throws on duplicate headers.
(read-single-table-with-info service
spreadsheet-id
sheet-name
&
[{:keys [prune-start? filter-fn row-idx?
column-name-fn]
:or {column-name-fn ->kebab-keyword}
:as options}])Read a sheet that has leading Name-Value info params followed by a table. Returns [info-map records].
Options: :prune-start?, :filter-fn, :row-idx?, :column-name-fn
Read a sheet that has leading Name-Value info params followed by a table. Returns [info-map records]. Options: :prune-start?, :filter-fn, :row-idx?, :column-name-fn
(row->record headers
row
&
[{:keys [remove-blank-keys] :or {remove-blank-keys true}}])Map a header vector to a row vector. By default removes nil-key and blank-value entries. Options: :remove-blank-keys - when false, keeps all entries including blanks (default true)
Map a header vector to a row vector. By default removes nil-key and blank-value entries. Options: :remove-blank-keys - when false, keeps all entries including blanks (default true)
(split-sections raw headers {:keys [section-fn subsection-fn record-filter-fn]})Group a vec-vec into sections (and optionally subsections). Options: :section-fn - (record, raw-row) → section name string or nil :subsection-fn - (record, raw-row) → subsection name string or nil (optional) :record-filter-fn - (record) → truthy to keep record (optional)
Group a vec-vec into sections (and optionally subsections). Options: :section-fn - (record, raw-row) → section name string or nil :subsection-fn - (record, raw-row) → subsection name string or nil (optional) :record-filter-fn - (record) → truthy to keep record (optional)
(split-tables raw)Parse a vec-vec where non-blank column-A values are section names. The row immediately after each section name is the header row. Returns a map of kebab-keyword section names → sequences of records.
Parse a vec-vec where non-blank column-A values are section names. The row immediately after each section name is the header row. Returns a map of kebab-keyword section names → sequences of records.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |