title: How do I iterate all the rows in a spreadsheet (including null)
body: <p>I am using apache poi to parse excel spreadsheet. According to the <a href="http://poi.apache.org/spreadsheet/quick-guide.html#Iterator" rel="nofollow noreferrer">poi iterator guide</a>, row iterator will skip the rows that are null. I wanted to iterate all rows, null or not. So I used for loop instead.</p>
  
  <pre><code>            Row row0 = sheet.getRow(0);
              for (Row row : sheet)
              {
                  rowIndex ++;
                  Cell cell = row.getCell(0);
                  if (cell != null) {
                       System.out.println(rowIndex);
                  }
              }
  </code></pre>
  
  <p>When I debugged it in Eclipse, for the following spreadsheet, row0 is null, however row in the first iteration of for loop is NOT null. The output (row index of first not null cell) is supposed to be 2, but it actually prints 1.</p>
  
  <p><a href="https://i.stack.imgur.com/Q6Ic6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q6Ic6.png" alt="spreadsheet"></a></p>
  
  <p><a href="https://i.stack.imgur.com/qofdm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qofdm.png" alt="debug in eclipse"></a></p>
  
  <p>Why is the first null row skipped by the for loop?</p>