I am trying to write a function which can create a excel file if not exists. If it exists it should append the contents at the end. The file can grow big so I want to use OPCPackage. Here is the code snippet:
String basePath = "/home/aman/Desktop";
String fileName = "result.xls";
File file = new File(basePath, fileName);
OPCPackage pkg = OPCPackage.openOrCreate(file);
Workbook wb = new XSSFWorkbook(pkg);
Instead of openOrCreate
I tried create()
function also but the error persists. So this leads me to doubt m understanding of open and create function of this package. Here is the question which has information of error occurred.