Apache POI only last cell is saved to a newly created file
<p>So I am pulling data from select cells from sheets in an excel file and then trying to write it to another file.  The data is being carried over fine inside the vatAdata array and from what I can tell its being written to the cell in the for loop because it prints out each cell after inserting into (just for debugging purposes). But when I open the file later only the last cell has data in it and all other cells are null. Any idea what is causing this issue?</p>

<pre><code>for(int i=0;i&lt;vatAdata.length;i++){
        Cell cellInsert=sheet.createRow(rowIndex).createCell(colIndex+i);
        cellInsert.setCellType(vatAtype[i]);
    //  System.out.println(cellInsert.);
        if(vatAtype[i]==0){
            cellInsert.setCellValue(Double.parseDouble(vatAdata[i]));
            System.out.println(cellInsert.getNumericCellValue()+" written");
        }
        else{
            cellInsert.setCellValue(vatAdata[i]);
            System.out.println(cellInsert.getStringCellValue()+" written");
        }
    }

    FileOutputStream out=new FileOutputStream("/home/chris/Documents/test.xlsx");
    wb.write(out);
    out.close();
</code></pre>
