我认为您可以使用此处建议的代码来获取列,然后针对列中的每一行(尽管与POI方法有关的行中的每一列更多),只需计算所需的值即可。
因此,您的代码可能遵循以下内容:
for(Row row : sheet) { short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for(short colIx = minColIx; colIx<maxColIx; colIx++) { Cell c = row.getCell(colIx); if(c != null) { if(c.getCellType() == Cell.CELL_TYPE_NUMERIC) {// add c.getNumericCellValue() } } }}


