Skip to content

Instantly share code, notes, and snippets.

@lokori
Last active August 30, 2016 19:26
Show Gist options
  • Save lokori/213c2415051a286f61a57b559496d45a to your computer and use it in GitHub Desktop.
Save lokori/213c2415051a286f61a57b559496d45a to your computer and use it in GitHub Desktop.
set-or-create-cell! for docjure
(defn set-or-create-cell!
([sheet n val type]
(let [cellref (org.apache.poi.ss.util.CellReference. n)
r (.getRow cellref)
col (int (.getCol cellref))
row (or (.getRow sheet r) (.createRow sheet r))
cell (or (select-cell n sheet) (.createCell row col type))]
(set-cell! cell val)))
([sheet n val]
(set-or-create-cell! sheet n val org.apache.poi.ss.usermodel.Cell/CELL_TYPE_STRING)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment