// Create a new workbook Workbook workbook = new Workbook(); // Open an excel file InputStream fileStream = this.getResourceStream("xlsx/AgingReport.xlsx"); workbook.open(fileStream); // clone the workbook IWorkbook clone = workbook.clone(); // Changes made to the cloned workbook will not affect the original workbook. clone.getWorksheets().get(0).delete(); // Save to an excel file workbook.save("WorkbookClone.xlsx");
// Create a new workbook var workbook = Workbook() // Open an excel file val fileStream = this.getResourceStream("xlsx/AgingReport.xlsx") workbook.open(fileStream) // clone the workbook val clone = workbook.clone() // Changes made to the cloned workbook will not affect the original workbook. clone.worksheets[0].delete() // Save to an excel file workbook.save("WorkbookClone.xlsx")