A thin Clojure wrapper around a small part of Apache POI for reading .xlsx
files.
For a more complete implementation, see the incanter-excel
module from the Incanter project. Althought, currently (August 2020) Incanter uses POI 3.16.
Leiningen/Boot
[ndevreeze/excel "0.3.1"]
Clojure CLI/deps.edn
ndevreeze/excel {:mvn/version "0.3.1"}
require
the namespace:
(ns your.project
(:require [ontodev.excel :as xls]))
Use it to load a workbook and read sheets:
(let [workbook (xls/load-workbook "test.xlsx")
sheet (xls/read-sheet workbook "Sheet1")]
(println "Sheet1:" (count sheet) (first sheet)))
Use the options parameter to get data back in different data formats: (xls/read-sheet {:values :values} workbook "Sheet1") (xls/read-sheet {:values :strings} workbook "Sheet1") (xls/read-sheet {:values :formatted} workbook "Sheet1")
Thanks to James Overton (ontodev) for starting this library.
This version adds option to get data in the correct datatypes, including dates and times. Also there is an option to get the formatted data.
$ lein midje
nil
All checks (83) succeeded.
0.2.5 - base version from ontodev 0.3.0 - another fork by joshuaeckroth 0.3.1 - use POI 4.1.2, return different data formats.
Copyright © 2014, James A. Overton Copyright © 2020, Nico de Vreeze
Distributed under the Simplified BSD License: http://opensource.org/licenses/BSD-2-Clause
Can you improve this documentation? These fine people already did:
James A. Overton & ndevreezeEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close