Reading Specific rows of an excel [closed]

You should try reading the documentation that comes with Apache POI!

Taken straight from there:

// Decide which rows to process
int rowStart = Math.min(1, sheet.getFirstRowNum()); // 0 based not 1 based rows
int rowEnd = Math.max(12, sheet.getLastRowNum());

for (int rowNum = rowStart; rowNum < rowEnd; rowNum++) {
   Row r = sheet.getRow(rowNum);

   int lastColumn = Math.max(r.getLastCellNum(), MY_MINIMUM_COLUMN_COUNT);

   for (int cn = 0; cn < lastColumn; cn++) {
      Cell c = r.getCell(cn, Row.RETURN_BLANK_AS_NULL);
      if (c == null) {
         // The spreadsheet is empty in this cell
      } else {
         // Do something useful with the cell's contents

This bit of the docs covers how to get the value of a cell

Browse More Popular Posts

Leave a Comment