Hi,
I am having trouble appending data to excel i am using apache as my import.
Workbook workbook = new HSSFWorkbook(); Sheet sheet2 = workbook.createSheet(); // the user inputs the RowNumber and the data is saved to that rowNumber Row row = sheet2.createRow(RowNumber); Cell cell = row.createCell(RowNumber); cell.setCellValue(CustomerName); String cellValue2 = cell.getRichStringCellValue().toString(); System.out.println("ddd"+cellValue2); Cell cell2 = row.createCell(1); cell2.setCellValue(PriceOfItem); Cell cell3 =row.createCell(2); cell3.setCellValue(AmountSoldFor); Cell cell4 = row.createCell(3); cell4.setCellValue(USShipping); Cell cell5 = row.createCell(4); cell5.setCellValue(JapanShipping); String cellValue1 = cell.getRichStringCellValue().toString(); System.out.print(cellValue1); try{ FileOutputStream output = new FileOutputStream("SaoriBusiness.xls"); workbook.write(output); output.close(); } catch(Exception e){ System.out.print("we have a problem"); } } }
The code works as desired, but it deletes my existing data. I thought this would be a simple solution, but after looking through the internet I am beginning to think that apache doesn't have a method to append data. This is frustrating, and can someone please confirm my suspicion that apache can or can't append existing data. If it does, can you help figure out to get it to append my data.