title: create multiple sheets on excel in java
body: <p>I'm trying to create two different sheets on a single excel file . But only getting the first sheet.How can I get the second sheet ? where did I mistake ? Please help</p>
  
  <p>Below is the code :</p>
  
  <pre><code>        WorkbookSettings ws = new WorkbookSettings();
          ws.setLocale(new Locale("en", "EN"));
          WritableWorkbook workbook = Workbook.createWorkbook(new File(filename), ws);
          WritableSheet s = workbook.createSheet("Summary", 0);
  
          // set font ,border,alignment
          cf.setWrap(true);
  
          Label l = null;
          l = new Label(0, 0, "Ticket Product", cf);
          s.addCell(l);
          ............................................
          ............................................
          // code to load data on the first sheet
  
  
          int columns = s.getColumns();
          for (i = 0; i &lt; columns; i++) 
          {
              //write on excel columnwise
          }
          workbook.write();
  
          s = workbook.createSheet("Details", 1);
  
          // set font ,border,alignment
          cf.setWrap(true);
  
          l = null;
          l = new Label(0, 0, "Ticket Product", cf);
          s.addCell(l);
          ............................................
          ............................................
          //code to load data on the second sheet
  
          columns = s.getColumns();
          for (i = 0; i &lt; columns; i++) 
          {
            //the same loop as before to write columnwise
          }
  
          workbook.write();
          workbook.close();
  </code></pre>