title: Fetching Data From xlsx sheet, not showing last three rows in jtable
body: <p>I am trying to fetching data from excel sheet(.xlsx) file. when I use to print fetched data using</p>
  <p>System.out.println(sheet.getRow(i).getCell(c).getStringCellValue()); I see the all the rows from excel sheet is fetched. But when I add this data in jtable it misses last three rows and shows following error:</p>
  <p><em><strong>Cannot invoke &quot;org.apache.poi.xssf.usermodel.XSSFRow.getCell(int)&quot; because the return value of &quot;org.apache.poi.xssf.usermodel.XSSFSheet.getRow(int)&quot; is null</strong></em></p>
  <pre><code>enter code here
  
  
       JFileChooser fileChooser = new JFileChooser(&quot;D:&quot;);
      
          int returnValue = fileChooser.showOpenDialog(null);
          if (returnValue == JFileChooser.APPROVE_OPTION) {
          selectedFile = fileChooser.getSelectedFile();
  
          FileName = selectedFile.getName();
          String FilePath = selectedFile.getPath();
          System.out.println(FileName);
          System.out.println(FilePath);
        
          File excelfile = new File(FileName);
          
         try{ 
         
         FileInputStream fis = new FileInputStream(selectedFile);
           
         XSSFWorkbook wb = new XSSFWorkbook(fis);
         XSSFSheet sheet = wb.getSheetAt(0);
         int totalrows = sheet.getPhysicalNumberOfRows();
         
                  
      
         for (int i = 0; i &lt;=totalrows; )
         {
      
          dmodel.addRow(new Object[]{&quot;&quot; });
       
         System.out.println(sheet.getRow(i).getCell(0).getStringCellValue());   // this line work
         String name = sheet.getRow(i).getCell(0).getStringCellValue();  
         jTable1.setValueAt(name , i, 0);    // this line does not work        
          
         i++ ;
        
         
         
        } 
         
            JOptionPane.showMessageDialog(null, &quot;All rows are fetched Successfully&quot; );
         
         
         
     }catch(Exception fx)
            {
            System.out.println(fx.getMessage()); 
           // System.out.println(fx.getCause());
            
            }
  </code></pre>