API for excel
-
by David James Humphreys
Full namespace name:
incanter.excel
Overview
Excel module for reading and writing Incanter datasets. Recognizes both old and new
Excel file formats (.xls and .xlsx).
Public Variables and Functions
read-xls
multimethod
No usage documentation available
Read an Excel file into a dataset. Note: cells containing formulas will be
empty upon import. Can read both older and newer Excel file formats, uses the filename suffix
or :override-format option.
Options are:
:sheet either a String for the tab name or an int for the sheet index -- defaults to 0
:header-keywords convert the incoming header line to keywords -- defaults to false (no conversion)
:override-format If nil use the filename suffix to guess the Excel file format. If :xls
or :xlsx override the suffix check.
:all-sheets? true to try to read in all sheets of data (false by default).
Examples:
(use '(incanter core io excel))
(view (read-xls "http://incanter.org/data/aus-airline-passengers.xls"))
(use '(incanter core charts excel))
;; read .xls file of Australian airline passenger data from the 1950s.
(with-data (read-xls "http://incanter.org/data/aus-airline-passengers.xls")
(view $data)
;; time-series-plot needs time in millisecs
;; create a function, to-millis, to convert a sequence of Date objects
;; to a sequence of milliseconds
(let [to-millis (fn [dates] (map #(.getTime %) dates))]
(view (time-series-plot (to-millis ($ :date)) ($ :passengers)))))
Source
save-xls
multimethod
No usage documentation available
Save a dataset to an Excel file. Can save in both older and newer
Excel formats, uses the filename suffix or :override-format option.
By passing in a collection of datasets and names it is possible to write more than
one sheet at a time: e.g.
(save-xls ["first sheet" dataset1 "second" dataset2] my-file)
Options are:
:sheet defaults to "dataset" if not provided.
:use-bold defaults to true. Set the header line in bold.
:override-format If nil use the filename suffix to guess the Excel file format.
If :xls or :xlsx override the suffix check.
Examples:
(use '(incanter core datasets excel))
(save-xls (get-dataset :cars) "/tmp/cars.xls")
Source
excel.cells
Functions for reading and writing to cells.
excel.workbook
Public Variables and Functions
get-workbook-sheet
multimethod
No usage documentation available
Retrieve the Excel workbook based on either the index or the sheet name.
Source