Are there any warappers/utils available to read Excel files in Groovy. I am looking for something similar to Groovy SQL\'s rows function as shown in below spock test ex
I could also recommend use Groovy Spreadsheet Builder. It available in maven repository (contrary to ExcelBuilder
) and also have expressive Groovy-syntax:
SpreadsheetQuery query = PoiSpreadsheetCriteria.FACTORY.forFile(file) // <1>
Collection cells = query.query {
sheet {
row {
cell {
value 'B'
}
}
}
}
assert cells.size() == 1
assert cells.first().value == 'B'
Or:
Collection rows = query.query {
sheet(name({ name.startsWith('Con') })) {
row(1)
}
}.rows
Documentation contains many examples. It even may write Excel files in same way!