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.
Leave a Reply