How to convert my xlsx sheet to java object using Apache POI

前端 未结 9 1448
情书的邮戳
情书的邮戳 2020-12-14 22:06

can any one suggest me to convert my xlsx sheet to java object using Apache POI.

eq, my excel sheet contains two columns

  • emp_no emp_name
  • 01
9条回答
  •  粉色の甜心
    2020-12-14 22:32

    I wanted to find a simple way to parse a xls/xlsx file to a list of pojo. After some searching i didn't find anything convenient and preferred to develop it quickly. Now i am able to get pojos by simply calling :

    InputStream is = this.getClass().getResourceAsStream("/ExcelUtilsTest.xlsx");
    List pojos = ExcelToPojoUtils.toPojo(Pojo.class, is);
    

    If interested take a look on it :

    https://github.com/ZPavel/excelToPojo

提交回复
热议问题