Parse Excel with Kotlin

I want to share how to parse excel files using kotlin and apache poi java lib. repository can be found here.

This example will parse a sheet with several cell type (number, string, date). The basic ideas are:
1. get the Workbook instance by instantiating XSSFWorkbook(file: File)
2. get the Sheet instance by call workbook.getSheetAt(idx: Int) or workbook.getSheet(sheetName: String)
3. traverse every rows in the sheet by call sheet.getRow(idx: Int)
4. traverse every columns in the row.


Comments

One response to “Parse Excel with Kotlin”

  1. Nice post man, it really helped me, thanks for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *