csv-cleaver

(defn chunk-rows
  "Split rows into files of at most n data rows, header repeated."
  [header rows n]
  (map-indexed (fn [i part] {:file (str "part-" (inc i) ".csv")
                             :rows (cons header part)})
               (partition-all n rows)))
Row chunking

2026-05-11 · #babashka #clojure

© Andrew Nimmo · All rights reserved