Reading excel documents in Clojure
Let me take a minute to introduce you to a library called Incanter. Incanter is a wonderful little R-style statistical computing library written in Clojure. It is also the easiest way to read in data sets from Microsoft Excel documents in Clojure.
To use Incanter just include it in your project.clj (you are using lein, right) using:
Then run lein deps in your console to install the dependency.
After that all you need to do to retrieve an excel file is use the following code.
(use ‘(incanter core io excel))
(defn get_excel (read-xls “/My/File/Location.xlsx”))
There you are. You now have the content of your excel file in a readable, manipulable list that you can use any way you please. This is both an easier and more pleasant experience than what I’ve seen with Excel documents in ruby, especially when you need to open both xls and xlsx documents.