Is there a Scala wrapper for Apache POI?

Peter Kofler picture Peter Kofler · Feb 17, 2011 · Viewed 9.6k times · Source

I would like to use Apache POI to read/create Excel files in an Scala app. Sure, I can use the POI library directly, it's Java after all, but I would like to have the Scala feel. So is there a Scala wrapper bringing the Scala feel (using implicit conversions), i.e. some kind of "Scala-POI-DSL" freely available?

Answer

folone picture folone · Sep 21, 2011

Thanks to Dave Griffith's answer, I've hacked something similar to his DSL.

Workbook {
      Sheet("name") {
        Row(1) {
          Cell(1, "data") :: Cell(2, "data2") :: Nil
        } ::
        Row(2) {
          Cell(1, "data") :: Cell(2, "data2") :: Nil
        } :: Nil
      } ::
      Sheet("name2") {
        Row(2) {
          Cell(1, "data") :: Cell(2, "data2") :: Nil
        } :: Nil
      } :: Nil
    }.save("/home/path/ok.xls")

Code can be found here.