Advertisement
Guest User

Untitled

a guest
Jul 11th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.41 KB | None | 0 0
  1. val file = File("/home/user/file.xlsx")
  2. val opcPackage = OPCPackage.open(file)
  3. val workbook = XSSFWorkbook(opcPackage)
  4.  
  5. workbook.getSheet("Sheet1").rowIterator().forEach { row ->
  6.   row.cellIterator().forEach { cell ->
  7.     when (cell.cellTypeEnum) {
  8.       CellType.STRING -> print("${cell.stringCellValue}\t")
  9.       CellType.NUMERIC -> print("${cell.numericCellValue}\t")
  10.       else -> print("")
  11.     }
  12.   }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement