   [[\"Name\" \"Price\"]
    [\"Foo Widget\" 100]
    [\"Bar Widget\" 200]]"
-  (let [cols (array-map :title "Task", :state "Status", :milestone "Milestone")
+  (let [cols columns
         rows (issues->rows cols issues)
         data (into [(vals cols)] (map vals rows)) ]
     (println "---------------")

(ns labradoodle.excel
  (:use [dk.ative.docjure.spreadsheet]))

; http://stackoverflow.com/questions/1676891/mapping-a-function-on-the-values-of-a-map-in-clojure
(defn fmap [f m]
  (into {} (for [[k v] m] [k (f v)])))

(defn map-key-comparator [m a b]
  "Sort order is based on order of keys in map m"
  (let [idxa (.indexOf (keys m) a)
        idxb (.indexOf (keys m) b)]
    ;(println (str "A: " a "->" idxa))
    ;(println (str "B: " b "->" idxb))
    (compare idxa idxb)))

(defn issues->rows [cols issues]
  "Produces rows array, with shape like this:


(defn issues->wb [proj issues]
  "Creates a spreadsheet containing data from issues"
  (let [sheet-name (str (:name proj) " Issues")
        celldata (issues->celldata issues)
        wb (create-workbook sheet-name celldata)
