title: Extract data from excel to mysql in java
body: <p>I want to extract data from excel to mysql but at the beginning  i want just to read the file so i use the code below :</p>
  
  <pre><code>@RestController
  public class ExtractDataController {
  
       protected String[] celluls;
  
      @RequestMapping(value = "/readExcel", method = RequestMethod.GET)
      public String processExcel()        
      {
  
          try {
  
              InputStream ExcelFileToRead = new FileInputStream("Test.xlsx");
              //définir l'objet workbook
              XSSFWorkbook  wb = new XSSFWorkbook(ExcelFileToRead);  
              //Itérer sur le nombre de sheets
              for(int i=0;i&lt;wb.getNumberOfSheets();i++)
              {
              XSSFSheet sheet = wb.getSheetAt(i);
              //Itérer sur les lignes
              for(int k=0;k&lt;sheet.getLastRowNum();k++)
              {
              XSSFRow ligne = sheet.getRow(k);
              celluls = new String[ligne.getLastCellNum()];
              for(int j=0;j&lt;ligne.getLastCellNum();j++){
                  if(ligne.getCell(j).getCellType() == 0)
  
                      celluls[j] = ""+ligne.getCell(j).getNumericCellValue();
                  else if(ligne.getCell(j).getStringCellValue().equals("/0"))
                      celluls[j] = ""+0;
                  else if(!ligne.getCell(j).getStringCellValue().equals("NIL") &amp;&amp; !ligne.getCell(j).getStringCellValue().equals("NULL") &amp;&amp; !ligne.getCell(j).getStringCellValue().equals("/0"))
                      {celluls[j] = ligne.getCell(j).getStringCellValue();
                      System.out.println(celluls[j]);
                      }
                  else celluls[j] = null;
                  System.out.println(celluls[j]);
              }
  
              }
  
          }} catch (Exception e) {
              System.err.println("Erreur");
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          return "data extracted successfully";
      }}
  </code></pre>
  
  <p>Now , the file Test.xsls has just 2 rows and 1 sheet just to test the code but when i run the application i have the first row duplicated and it doesn't read the seconde one .</p>
  
  <p>Here's the data of my file</p>
  
  <pre><code>Country cc  ndc RS
  France  36  123 roaming international
  Maroc   12  145 roaming international
  </code></pre>
  
  <p>And here's what i get </p>
  
  <pre><code>Country
  Country
  cc
  cc
  ndc
  ndc
  RS
  RS
  France
  France
  36.0
  123.0
  roaming international
  roaming international
  Country
  Country
  cc
  cc
  ndc
  ndc
  RS
  RS
  France
  France
  36.0
  123.0
  roaming international
  roaming international
  </code></pre>
  
  <p>Any ideas please?</p>