Apache POI SS - Copy Sheet Within Workbook

Workbook wb = new HSSFWorkbook();
wb.createSheet("new sheet");
wb.createSheet("second sheet");
Sheet cloneSheet = wb.cloneSheet(0);

// now you have to manually copy all the data into new sheet from the cloneSheet


//Create a new Workbook by excel file path
Workbook wb = new Workbook("data/workbook.xls");

//Create a Worksheets object with reference to the sheets of the Workbook.
WorksheetCollection sheets = wb.getWorksheets();

//Copy data to a new sheet from an existing sheet within the Workbook.

//Save the excel file.

Download Source Code

For More Examples, Please Visit Aspose Docs

Last edited May 14, 2014 at 10:34 AM by shoaibkhan, version 4