Utilities for declarative creation of Excel (.xlsx) spreadsheets, with higher level abstractions over Apache POI (https://poi.apache.org/).
The highest level data abstraction used to create excel spreadsheets is a tree, followed by a table, and finally the most basic abstraction is a grid.
The tree and table functions convert tree formatted or tabular data into a grid of [[cell]].
See the (comment) form with examples at the bottom of this namespace.
Utilities for declarative creation of Excel (.xlsx) spreadsheets, with higher level abstractions over Apache POI (https://poi.apache.org/). The highest level data abstraction used to create excel spreadsheets is a tree, followed by a table, and finally the most basic abstraction is a grid. The tree and table functions convert tree formatted or tabular data into a grid of [[cell]]. See the (comment) form with examples at the bottom of this namespace.
(append! workbook from-path path)
(append! workbook
from-path
path
{:keys [streaming? auto-size-cols?] :or {streaming? true} :as ops})
Merge the workbook
with the one saved at from-path
, write it to the
given path
, and return a file object pointing at the written file.
The workbook is a key value collection of (sheet-name grid), either as map or an association list (if ordering is important).
The 'merge' logic overwrites sheets of the same name in the workbook at
from-path
, so this function is only capable of appending sheets to a
workbook, not appending cells to a sheet.
Merge the `workbook` with the one saved at `from-path`, write it to the given `path`, and return a file object pointing at the written file. The workbook is a key value collection of (sheet-name grid), either as map or an association list (if ordering is important). The 'merge' logic overwrites sheets of the same name in the workbook at `from-path`, so this function is only capable of appending sheets to a workbook, not appending cells to a sheet.
(append-stream! workbook from-stream stream)
(append-stream!
workbook
from-stream
stream
{:keys [streaming? auto-size-cols?] :or {streaming? true} :as ops})
Like append!
, but for streams.
Like `append!`, but for streams.
(best-guess-cell-format val column-name)
Try to guess appropriate formatting based on column name and cell value.
Try to guess appropriate formatting based on column name and cell value.
(juxtapose left-grid right-grid)
(juxtapose left-grid right-grid padding)
Put grids side by side (whereas concat
works vertically, this works
horizontally).
Optionally, supply some number of blank padding
columns between the two
grids.
Finds the maximum row width in the left-most grid and pads all of its rows to that length before sticking them together.
Put grids side by side (whereas `concat` works vertically, this works horizontally). Optionally, supply some number of blank `padding` columns between the two grids. Finds the maximum row width in the left-most grid and pads all of its rows to that length before sticking them together.
Deprecated in favor of quick-open!
.
Deprecated in favor of `quick-open!`.
(quick-open! workbook)
Write a workbook to a temp file & open it. Useful for quick repl viewing.
Write a workbook to a temp file & open it. Useful for quick repl viewing.
(quick-open-pdf! workbook)
Write a workbook to a temp file as a pdf & open it. Useful for quick repl viewing.
Write a workbook to a temp file as a pdf & open it. Useful for quick repl viewing.
Deprecated in favor of table-grid
.
Deprecated in favor of `table-grid`.
(table-grid rows)
(table-grid ks rows)
Build a lazy sheet grid from rows
.
Applies default styles to cells which are not already styled, but preserves any existing styles.
Additionally, expands any rows which are wrapped with style data to apply the style to each cell of the row. See the comment form below this function definition for examples.
This fn has the same shape as clojure.pprint/print-table.
Build a lazy sheet grid from `rows`. Applies default styles to cells which are not already styled, but preserves any existing styles. Additionally, expands any rows which are wrapped with style data to apply the style to each cell of the row. See the comment form below this function definition for examples. This fn has the same shape as clojure.pprint/print-table.
Deprecated in favor of tree-grid
.
Deprecated in favor of `tree-grid`.
(tree-grid tree)
(tree-grid ks tree)
Build a lazy sheet grid from tree
, whose leaves are shaped key->number.
E.g. (tree-grid {:assets {:cash {:usd 100 :eur 100}}})
See the comment form below this definition for examples.
Build a lazy sheet grid from `tree`, whose leaves are shaped key->number. E.g. (tree-grid {:assets {:cash {:usd 100 :eur 100}}}) See the comment form below this definition for examples.
(with-title title [row & _ :as grid])
Prepend a centered title
row to the grid
with the same width as the
first row of the grid.
Prepend a centered `title` row to the `grid` with the same width as the first row of the grid.
(write! workbook path)
(write! workbook
path
{:keys [streaming? auto-size-cols?] :or {streaming? true} :as ops})
Write the workbook
to the given path
and return a file object pointing
at the written file.
The workbook is a key value collection of (sheet-name grid), either as map or an association list (if ordering is important).
Write the `workbook` to the given `path` and return a file object pointing at the written file. The workbook is a key value collection of (sheet-name grid), either as map or an association list (if ordering is important).
(write-pdf! workbook path)
Write the workbook to the given filename and return a file object pointing at the written file.
Requires OpenOffice. See https://github.com/sbraconnier/jodconverter.
The workbook is a key value collection of (sheet-name grid), either as map or an association list (if ordering is important).
Write the workbook to the given filename and return a file object pointing at the written file. Requires OpenOffice. See https://github.com/sbraconnier/jodconverter. The workbook is a key value collection of (sheet-name grid), either as map or an association list (if ordering is important).
(write-stream! workbook stream)
(write-stream!
workbook
stream
{:keys [streaming? auto-size-cols?] :or {streaming? true} :as ops})
Like write!
, but for a stream.
Like `write!`, but for a stream.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close