title: How to go though the sheets of a Workbook with Apache POI?
body: <p>I am a real newb programer trying to make a small java program that edits spreadsheets for a friend using Apache Poi. Currently I go through the excel file using this code:</p>
  
  <pre><code>Sheet paxgs = rs1.getSheetAt(0); 
  for (Row row : paxgs) {
         Cell secCell = row.getCell(1);
         Cell firstCell = row.getCell(0);
         if (firstCell!=null &amp;&amp; firstCell.getCellType()==firstCell.CELL_TYPE_STRING)
  }
  </code></pre>
  
  <p>The problem is that I don't know the exact number of sheets that the excel file is going to have. I tried :</p>
  
  <pre><code>Workbook rs1 = WorkbookFactory.create(new FileInputStream(filename));    
  for (Sheet sheet : rs1)
  </code></pre>
  
  <p>but it didn't work so I was wondering if there is any way to go through all the sheet of a workbook.</p>