title: handling empty columns in apache poi
body: <p>I have a program reading excel sheet from a java program. </p>
  
  <p>I am iterating over cells as below:</p>
  
  <pre><code>Iterator cells = row.cellIterator();
  String temp;
  StringBuilder sb;
  SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
  
  while (cells.hasNext()) {
  Cell cell = (Cell) cells.next();
  temp = null;
  
      switch (cell.getCellType()) {
           case Cell.CELL_TYPE_STRING:
           temp = cell.getRichStringCellValue().getString();
           break;
  
      case Cell.CELL_TYPE_NUMERIC:
  
      if (DateUtil.isCellDateFormatted(cell)) {
          temp = sdf.format(cell.getDateCellValue());
         } else {
               temp = df.format(new BigDecimal(cell.getNumericCellValue()));
         }
            break;
            default:
       }
      if (temp == null || temp.equalsIgnoreCase("null")) {
          sb.append("").append(";");
      } else {
          sb.append(temp).append(";");
      }
   }
  </code></pre>
  
  <p>As seen, I am trying to create a string builder containing values from excel row in semicolon separated way. </p>
  
  <p>Issue is, if a column value is empty, I want it as an empty value in the string builder with two consecutive semicolons. </p>
  
  <p>However, the call </p>
  
  <blockquote>
    <p>Cell cell = (Cell) cells.next();</p>
  </blockquote>
  
  <p>simply ignores the empty cells and jumps over to next non empty cell. </p>
  
  <p>So the line </p>
  
  <blockquote>
    <p>if (temp == null || temp.equalsIgnoreCase("null"))</p>
  </blockquote>
  
  <p>is never met. </p>
  
  <p>How to get a handle on empty column values as well in the iterator ?</p>