y-yu / excel-reads   0.5.1

MIT License GitHub

Excel row parser using Scala macro

Scala versions: 2.13

Excel-Reads

CI

Abstract

This is the Excel row(s) parser library using Scala macro.

How to use

I recommend to use Apache POI version.

libraryDependencies += "com.github.y-yu" %% "excel-reads-apache-poi" % "0.5.1"
case class HelloWorld(
  hello: String,
  world: String
)

type R = Fx.fx3[Reader[ApachePoiSheet, *], State[Int, *], Either[ExcelParseErrors, *]]

val workbook = WorkbookFactory.create(
  new File("/test.xlsx")
)
val sheet = ApachePoiSheet(workbook.getSheet("Sheet1"))

val actual = ExcelSheetReads
  .parse[R, HelloWorld]
  .evalState(0)
  .runReader(sheet)
  .runEither
  .run

assert(actual == Right(HelloWorld("hello", "world")))

See also tests.

References