How to get value from a specific cell of an xlsx file using java apache poi

前端 未结 5 1399
一生所求
一生所求 2020-12-30 08:54

I am writing a java program to read an excel sheet (xlsx) using apache poi. I am able to iterate through all the cells and get all the values. But I am unable to get a spec

5条回答
  •  执笔经年
    2020-12-30 09:12

    For example, to get E10 of the first worksheet:

    wb.getSheetAt(0).getRow(9).getCell(4); 
    

    Note: subtract one because the indices are null-based.

    You can also use this convenience method to map E to 4.

    wb.getSheetAt(0).getRow(9).getCell(CellReference.convertColStringToIndex("E"));
    

提交回复
热议问题