My code when generating a spreadsheet within an excel file it erases all the others, how do I make it create the spreadsheet in 2nd without deleting the others?
My code:
import java.io.*;
import org.apache.poi.xssf.usermodel.*;
public class Apache {
public static void main(String[] args)throws Exception {
XSSFWorkbook workbook = new XSSFWorkbook();
FileOutputStream out = new FileOutputStream("workbook.ods");
XSSFSheet spreadsheet = workbook.createSheet("teste 2");
workbook.write(out);
out.close();
System.out.println("workbook.ods");
}
}