I am reading a value from excel and then after some logic writing some values into an excel file. The problem is only the last value is being written in the excel.
I am calling writeExcel method each time I have to write a row in the excel.
Below is the code.
FileOutputStream fileOut = new FileOutputStream("poc-test.xls");
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet worksheet = workbook.createSheet("POC Worksheet");
public void writeExcel(String str) throws Exception{
HSSFRow row1 = worksheet.createRow((short) i++);
HSSFCell cellA1 = row1.createCell((short) 0);
cellA1.setCellValue(str);
workbook.write(fileOut);
}