title: How to retrieve some specific rows and columns from an excel sheet?
body: <ul>
  <li>I am reading an xlsx file using java (Apache POI).</li>
  <li>I have created a Document class (having all excel column heading as variables)</li>
  <li>i have to read each row in the excel and map to the Document class by creating a collection of Document class.</li>
  <li><p>The problem I am facing is that I have to start reading from row 2 and from column 7 to column 35 and map the corresponding values to the document class.</p></li>
  <li><p>Unable to to figure out exactly how the code should be ?</p></li>
  <li>I have written the following lines of code. </li>
  </ul>
  
  <p></p>
  
  <pre><code> List sheetData = new ArrayList();
          InputStream excelFile = new BufferedInputStream(new FileInputStream("D:\\Excel file\\data.xlsx"));
          Workbook workBook = new XSSFWorkbook(excelFile); // Creates Workbook
          XSSFSheet sheet = (XSSFSheet) workBook.getSheet("Daily");
          DataFormatter formatter = new DataFormatter();
          for (int i = 7; i &lt;= 35; i++) {
              XSSFRow row = sheet.getRow(i);
              Cell cell = row.getCell(i);
              String val = formatter.formatCellValue(cell);
              sheetData.add(val);
          }
  </code></pre>
  
  <p></p>