title: Need to read huge excel file with 60 column in java using apache POI
body: <p>I am reading excel file with around 60 column and 500 rows. I am converting them in our java object form using Apahce POI. But all this I am doing it with switch statement and making different case based on column index. I don't think it is correct way to iterate excel and convert it to java objects. So can you suggest me nice way to do this. </p>
  
  <p>Currently doing like this....</p>
  
  <pre><code>public class Employee
  {
  private String empNo;
  private String empName;
  ...
  ..
  ...
  ....like this 60 column header 
  ...
  }
  </code></pre>
  
  <p>I don't like it to do this way, is there any other way you can suggest me. 
  Thanks for help in advance
  in another class.</p>
  
  <pre><code>FileInputStream file = new FileInputStream(new File("C:\\test.xls"));
  
  HSSFWorkbook workbook = new HSSFWorkbook(file);
  HSSFSheet sheet = workbook.getSheetAt(0);
  List&lt;Employee&gt; list = new AraayList&lt;Employee&gt;();
  Iterator&lt;Row&gt; rowIterator = sheet.iterator();
  while(rowIterator.hasNext()) {
      Employee e = new Employee();
      Row row = rowIterator.next();
      Iterator&lt;Cell&gt; cellIterator = row.cellIterator();
      while(cellIterator.hasNext()) {
  
          Cell cell = cellIterator.next();
  
          switch(cell.getColumnIndex()) {
              case 0:
                  e.setEmpName(cell.getStringCellValue());
                  break;
              case 1:
                  e.setEmpNo(cell.getNumericCellValue());
                  break;
                  .....
                  ......
                  ......
                  ..
                  ...
              case 60: e.setStreet(cell.getStringCellValue());
                  list.add(e);
                  break;
          }
      }
  }
  
  } catch (FileNotFoundException e) {
      e.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>