lundi 30 mars 2015

Apache POI :Reading xlsx no rows, reading xls all rows

I have the following scala code to load a file:



import org.apache.poi.ss.usermodel.WorkbookFactory
import scala.collection.JavaConversions._

val wb = WorkbookFactory.create(new File(s"/tmp/$filename"))
val sheet = wb.getSheet("Pricelist")
println(s"${sheet.getLastRowNum}")


If I pass a xls, the last row number is given:


However on the xlsx (same file, but then saved as xlsx) it returns -1. I have tried various files generated by different software (office/LibreOffice) however it still keeps returning -1. Anyone came across this before as I found little about this issue.


Aucun commentaire:

Enregistrer un commentaire