Excel module for reading and writing Incanter datasets. Recognizes both old and new Excel file formats (.xls and .xlsx).
Excel module for reading and writing Incanter datasets. Recognizes both old and new Excel file formats (.xls and .xlsx).
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)))))
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)))))
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")
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")
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close