This is the Excel row(s) parser library using Scala macro.
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.
- (Japanese) Tagless-final + EffでExcelシートをパーズする
- (Japanese) Tagless-final + EffなScalaによるExcelパーザー