(add-sheet! workbook name)
Add a new sheet to the workbook.
Add a new sheet to the workbook.
(cell-fn outputcell sheet & inputcells)
Turn a cell (ideally containing a formula) into a function. The returned function will take a variable number of parameters, updating each of the inputcells in the sheet with the supplied values and return the value of the cell outputcell. Cell names are specified using Excel syntax, i.e. A2 or B12.
Turn a cell (ideally containing a formula) into a function. The returned function will take a variable number of parameters, updating each of the inputcells in the sheet with the supplied values and return the value of the cell outputcell. Cell names are specified using Excel syntax, i.e. A2 or B12.
Return a seq of the cells in the input which can be a sheet, a row, or a collection of one of these. The seq is ordered ordered by sheet, row and column. Missing cells will be returned as nil, note this is different from blank cells which have type (CellType/BLANK)
Return a seq of the cells in the input which can be a sheet, a row, or a collection of one of these. The seq is ordered ordered by sheet, row and column. Missing cells will be returned as nil, note this is different from blank cells which have type (CellType/BLANK)
(color-index colorkw)
Returns color index from org.apache.ss.usermodel.IndexedColors from lowercase keywords
Returns color index from org.apache.ss.usermodel.IndexedColors from lowercase keywords
(create-cell-style! workbook)
(create-cell-style! workbook styles)
Create a new cell-style in the workbook from options:
:background background colour (as keyword) :font font | fontmap (of font options) :halign :left | :right | :center :valign :top | :bottom | :center :wrap true | false - controls text wrapping :border-left :thin | :medium | :thick :border-right :thin | :medium | :thick :border-top :thin | :medium | :thick :border-bottom :thin | :medium | :thick
Valid color keywords are the colour names defined in org.apache.ss.usermodel.IndexedColors as lowercase keywords, eg.
:black, :white, :red, :blue, :light_green, :yellow, ...
Examples: I. (def f (create-font! wb {:name "Arial", :bold true, :italic true}) (create-cell-style! wb {:background :yellow, :font f, :halign :center, :wrap true, :borders :thin}) II. (create-cell-style! wb {:background :yellow, :halign :center, :font {:name "Arial" :bold true :italic true}, :wrap true, :borders :thin})
Create a new cell-style in the workbook from options: :background background colour (as keyword) :font font | fontmap (of font options) :halign :left | :right | :center :valign :top | :bottom | :center :wrap true | false - controls text wrapping :border-left :thin | :medium | :thick :border-right :thin | :medium | :thick :border-top :thin | :medium | :thick :border-bottom :thin | :medium | :thick Valid color keywords are the colour names defined in org.apache.ss.usermodel.IndexedColors as lowercase keywords, eg. :black, :white, :red, :blue, :light_green, :yellow, ... Examples: I. (def f (create-font! wb {:name "Arial", :bold true, :italic true}) (create-cell-style! wb {:background :yellow, :font f, :halign :center, :wrap true, :borders :thin}) II. (create-cell-style! wb {:background :yellow, :halign :center, :font {:name "Arial" :bold true :italic true}, :wrap true, :borders :thin})
(create-font! workbook options)
Create a new font in the workbook with options:
:name font family (string)
:size font size (integer)
:color font color (keyword)
:bold true | false
:italic true | false
:underline true | false
Example:
(create-font! wb {:name "Arial", :size 12, :color :blue, :bold true, :underline true})
Create a new font in the workbook with options: :name font family (string) :size font size (integer) :color font color (keyword) :bold true | false :italic true | false :underline true | false Example: (create-font! wb {:name "Arial", :size 12, :color :blue, :bold true, :underline true})
(create-sparse-workbook sheet-name data)
(create-sparse-workbook sheet-name data & name-data-pairs)
Create a new XLSX workbook. Sheet-name is a string name for the sheet. Data is a vector of vectors, representing the rows and the cells of the rows. Alternate sheet names and data to create multiple sheets.
Spreadsheet rows and cells can be nil, which will create a sparse spreadsheet with non-continuous rows and cells
(This version exists mostly for generating test data, create-workbook
will
normally do just fine unless you have a specific need for sparseness)
(create-sparse-workbook "SheetName1" [["A1" "A2"] nil ["C1" nil "C3"]] "SheetName2" [["A1" "A2"] nil ["C1" nil "C3"]]
Create a new XLSX workbook. Sheet-name is a string name for the sheet. Data is a vector of vectors, representing the rows and the cells of the rows. Alternate sheet names and data to create multiple sheets. Spreadsheet rows and cells can be nil, which will create a sparse spreadsheet with non-continuous rows and cells (This version exists mostly for generating test data, `create-workbook` will normally do just fine unless you have a specific need for sparseness) (create-sparse-workbook "SheetName1" [["A1" "A2"] nil ["C1" nil "C3"]] "SheetName2" [["A1" "A2"] nil ["C1" nil "C3"]]
(create-workbook sheet-name data)
(create-workbook sheet-name data & name-data-pairs)
Create a new XLSX workbook. Sheet-name is a string name for the sheet. Data is a vector of vectors, representing the rows and the cells of the rows. Alternate sheet names and data to create multiple sheets.
(create-workbook "SheetName1" [["A1" "A2"]["B1" "B2"]] "SheetName2" [["A1" "A2"]["B1" "B2"]]
Create a new XLSX workbook. Sheet-name is a string name for the sheet. Data is a vector of vectors, representing the rows and the cells of the rows. Alternate sheet names and data to create multiple sheets. (create-workbook "SheetName1" [["A1" "A2"]["B1" "B2"]] "SheetName2" [["A1" "A2"]["B1" "B2"]]
(create-xls-workbook sheet-name data)
Create a new XLS workbook with a single sheet and the data specified.
Create a new XLS workbook with a single sheet and the data specified.
(get-row-styles row)
Returns a seq of the row's CellStyles. Missing cells will return a nil style
Returns a seq of the row's CellStyles. Missing cells will return a nil style
(horiz-align kw)
Returns horizontal alignment
Returns horizontal alignment
A protocol that allows:
A protocol that allows: 1. interchangeable use of fonts and maps of font options 2. getting fonts from either XLS or XLSX cell styles, which normally requires distinct syntax.
(as-font this workbook)
(get-font this workbook)
(set-font this style workbook)
Load an Excel .xls or .xlsx workbook from an InputStream.
Load an Excel .xls or .xlsx workbook from an InputStream.
(load-workbook-from-file filename)
Load an Excel .xls or .xlsx workbook from a file.
Load an Excel .xls or .xlsx workbook from a file.
(load-workbook-from-resource resource)
Load an Excel workbook from a named resource. Used when reading from a resource on a classpath as in the case of running on an application server.
Load an Excel workbook from a named resource. Used when reading from a resource on a classpath as in the case of running on an application server.
(load-workbook-from-stream stream)
Load an Excel workbook from a stream. The caller is required to close the stream after loading is completed.
Load an Excel workbook from a stream. The caller is required to close the stream after loading is completed.
(remove-all-rows! sheet)
Remove all the rows from the sheet.
Remove all the rows from the sheet.
(remove-row! sheet row)
Remove a row from the sheet. Rows are not shifted up - the removed row will display as blank
Remove a row from the sheet. Rows are not shifted up - the removed row will display as blank
(row-seq sheet)
Return a lazy sequence of the rows in a sheet. Missing rows will be returned as nil filter with e.g. (remove nil? (row-seq ...)) if missing rows are not needed
Return a lazy sequence of the rows in a sheet. Missing rows will be returned as nil filter with e.g. (remove nil? (row-seq ...)) if missing rows are not needed
(row-vec column-order row)
Transform the row struct (hash-map) to a row vector according to the column order. Example:
(row-vec [:foo :bar] {:foo "Foo text", :bar "Bar text"})
["Foo text" "Bar text"]
Transform the row struct (hash-map) to a row vector according to the column order. Example: (row-vec [:foo :bar] {:foo "Foo text", :bar "Bar text"}) > ["Foo text" "Bar text"]
Save the workbook into a stream or a file. In the case of saving into a stream, the caller is required to close the stream after saving is completed.
Save the workbook into a stream or a file. In the case of saving into a stream, the caller is required to close the stream after saving is completed.
(save-workbook-into-file! filename workbook)
Save the workbook into a file.
Save the workbook into a file.
(save-workbook-into-stream! stream workbook)
Save the workbook into a stream. The caller is required to close the stream after saving is completed.
Save the workbook into a stream. The caller is required to close the stream after saving is completed.
(select-cell n sheet)
Given a Sheet and a cell reference (A1), select-cell returns the cell or nil if the cell could not be found
Given a Sheet and a cell reference (A1), select-cell returns the cell or nil if the cell could not be found
(select-columns column-map sheet)
Takes two arguments: column hashmap and a sheet. The column hashmap specifies the mapping from spreadsheet columns dictionary keys: its keys are the spreadsheet column names and the values represent the names they are mapped to in the result.
For example, to select columns A and C as :first and :third from the sheet
(select-columns {:A :first, :C :third} sheet) => [{:first "Value in cell A1", :third "Value in cell C1"} ...]
Takes two arguments: column hashmap and a sheet. The column hashmap specifies the mapping from spreadsheet columns dictionary keys: its keys are the spreadsheet column names and the values represent the names they are mapped to in the result. For example, to select columns A and C as :first and :third from the sheet (select-columns {:A :first, :C :third} sheet) => [{:first "Value in cell A1", :third "Value in cell C1"} ...]
(select-name workbook n)
Given a workbook and name (string or keyword) of a named range, select-name returns a seq of cells or nil if the name could not be found.
Given a workbook and name (string or keyword) of a named range, select-name returns a seq of cells or nil if the name could not be found.
Select a sheet from the workbook by name, regex or arbitrary predicate
Select a sheet from the workbook by name, regex or arbitrary predicate
(set-cell-comment! cell
comment-str
&
{:keys [font width height] :or {width 1 height 2}})
Creates a cell comment-box that displays a comment string when the cell is hovered over. Returns the cell.
Options:
:font (font | fontmap - font applied to the comment string) :width (int - width of comment-box in columns; default 1 cols) :height (int - height of comment-box in rows; default 2 rows)
Example:
(set-cell-comment! acell "This comment should span two lines." :width 2 :font {:bold true :size 12 :color blue})
Creates a cell comment-box that displays a comment string when the cell is hovered over. Returns the cell. Options: :font (font | fontmap - font applied to the comment string) :width (int - width of comment-box in columns; default 1 cols) :height (int - height of comment-box in rows; default 2 rows) Example: (set-cell-comment! acell "This comment should span two lines." :width 2 :font {:bold true :size 12 :color blue})
(set-cell-style! cell style)
Apply a style to a cell. See also: create-cell-style!.
Apply a style to a cell. See also: create-cell-style!.
(set-row-style! row style)
Apply a style to all the cells in a row. Returns the row.
Apply a style to all the cells in a row. Returns the row.
(set-row-styles! row styles)
Apply a seq of styles to the cells in a row. Cells that are missing won't be assigned a style - if you want to style missing cells, create them first
Apply a seq of styles to the cells in a row. Cells that are missing won't be assigned a style - if you want to style missing cells, create them first
(sheet-name sheet)
Return the name of a sheet.
Return the name of a sheet.
(sheet-seq workbook)
Return a lazy seq of the sheets in a workbook.
Return a lazy seq of the sheets in a workbook.
(vert-align kw)
Returns vertical alignment
Returns vertical alignment
(whens & [test expr :as clauses])
Processes any and all expressions whose tests evaluate to true. Example: (let [m (java.util.HashMap.)] (whens false (.put m :z 0) true (.put m :a 1) true (.put m :b 2) nil (.put m :w 3)) m) => {:b=2, :a=1}
Processes any and all expressions whose tests evaluate to true. Example: (let [m (java.util.HashMap.)] (whens false (.put m :z 0) true (.put m :a 1) true (.put m :b 2) nil (.put m :w 3)) m) => {:b=2, :a=1}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close