Skip to content

No method in multimethod 'cell-seq' for dispatch value: :default #116

@hamann

Description

@hamann

We ran into this while loading an xlsx

#error {
 :cause "No method in multimethod 'cell-seq' for dispatch value: :default"
 :via
 [{:type java.lang.IllegalArgumentException
   :message "No method in multimethod 'cell-seq' for dispatch value: :default"
   :at [clojure.lang.MultiFn getFn "MultiFn.java" 156]}]
 :trace
 [[clojure.lang.MultiFn getFn "MultiFn.java" 156]
  [clojure.lang.MultiFn invoke "MultiFn.java" 229]
  [clojure.core$map$fn__5954 invoke "core.clj" 2770]
  [clojure.lang.LazySeq force "LazySeq.java" 50]
  [clojure.lang.LazySeq realize "LazySeq.java" 89]
  [clojure.lang.LazySeq seq "LazySeq.java" 106]
  [clojure.lang.ChunkedCons chunkedNext "ChunkedCons.java" 61]
  [clojure.core$chunk_next invokeStatic "core.clj" 710]
  [clojure.core.protocols$fn__8270 invokeStatic "protocols.clj" 136]
  [clojure.core.protocols$fn__8270 invoke "protocols.clj" 123]
  [clojure.core.protocols$fn__8229$G__8224__8238 invoke "protocols.clj" 19]
  [clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 31]
  [clojure.core.protocols$fn__8262 invokeStatic "protocols.clj" 74]
  [clojure.core.protocols$fn__8262 invoke "protocols.clj" 74]
  [clojure.core.protocols$fn__8203$G__8198__8216 invoke "protocols.clj" 13]
  [clojure.core$reduce invokeStatic "core.clj" 6965]
  [clojure.core$mapv invokeStatic "core.clj" 7050]
  [clojure.core$mapv invoke "core.clj" 7050]

(defn- cell-seq-dispatch [x]
(cond
(isa? (class x) Row) :row
(isa? (class x) Sheet) :sheet
(seq? x) :coll
:else :default))
(defmulti cell-seq
"Return a seq of the cells in the input which can be a sheet, a row, or a collection
of one of these. The seq is ordered ordered by sheet, row and column.
Missing cells will be returned as nil, note this is different from blank cells which have type (CellType/BLANK)"
cell-seq-dispatch)
(defmethod cell-seq :row [^Row row] (map
#(.getCell row % Row$MissingCellPolicy/RETURN_NULL_AND_BLANK)
(range 0 (.getLastCellNum row))))
(defmethod cell-seq :sheet [sheet] (for [row (remove nil? (row-seq sheet))
cell (cell-seq row)]
cell))
(defmethod cell-seq :coll [coll] (for [x (remove nil? coll),
cell (cell-seq x)]
cell))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions