title: How to create rows automatically with Apache POI?
body: <p>I'm working in a  project in Java and I Need to create one xls file with some information.
  So,  depending on the amount of information, I need to create automatically Rows and cells to put this information.. </p>
  
  <p>Example: if the input documents has 13 Site Information, I need to create 13 Rows with 4 cell..
  How I do it?
  ..
  my attempt to code:</p>
  
  <pre><code>Workbook wb = new HSSFWorkbook();
      Sheet sheet = wb.createSheet("new sheet");
  
      int numberrows = Integer.parseInt(JOptionPane.showInputDialog(null, "numbers of sites??"));
  
  
      String siteName = JOptionPane.showInputDialog(null, "Site name");
      String rncname = JOptionPane.showInputDialog(null, "RncName");
  
  
      for (int i = 0; i &lt; numberrows; i++) {
          HSSFRow linha =  (HSSFRow) sheet.createRow(i);
  
          linha.createCell((short) i ).setCellValue(siteName);
          linha.createCell((short) i ).setCellValue(rncname);
  
      }
  </code></pre>
  
  <p>Thanks in advance..</p>