// Create a new workbook Workbook workbook = new Workbook(); //Load template file Flowcharts.xlsx from resource InputStream fileStream = this.getResourceStream("xlsx/FlowChartsFile.xlsx"); workbook.open(fileStream); // Copy the selected sheet collection to the end of current workbook. workbook.getWorksheets().get(new String[]{"FlowChart1", "FlowChart2"}).copy(); // Save to an excel file workbook.save("CopyMultipleWorksheets.xlsx");
// Create a new workbook var workbook = Workbook() // Load template file Flowcharts.xlsx from resource val fileStream = this.getResourceStream("xlsx/FlowChartsFile.xlsx") workbook.open(fileStream!!) // Copy the selected sheet collection to the end of current workbook. workbook.getWorksheets().get(arrayOf("FlowChart1", "FlowChart2")).copy() // Save to an excel file workbook.save("CopyMultipleWorksheets.xlsx")