I have a similar problem.
I have a large file (over 10 MB) which I need to read, and then insert a new sheet with data to the same file.
This is what I am doing
I have to read and write to the same file.
OPCPackage pkg = OPCPackage.open(stringFileName);
xwb = new XSSFWorkbook(pkg);//this is error line
tempsxwb = new SXSSFWorkbook(auctionSPFileXWB, 100, true, false);
I need the XssfWorkbook obj to read data from the file and then after working on that data I have to write a new sheet to the same file.
try(FileOutputStream fos = new FileOutputStream(stringFileName)){
tempsxwb.write(fos);
fos.flush();
}
tempsxwb.close();
can anybody suggest a solution?