Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Following are the steps involved for copying and moving worksheets within or between workbooks.
Aspose.Cells provides an overloaded method, WorksheetCollection.addCopy(), that is used to add a worksheet to the collection and copy data from an existing worksheet. One version of the method takes the index of the source worksheet as a parameter. The other version takes the name of the source worksheet.
The following example shows how to copy an existing worksheet within a workbook.
Copy sheets using Aspose.Cells
Java
//Create a new Workbook by excel file path
Workbook wb = new Workbook(dataDir + "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.
sheets.addCopy("Sheet1");Copy sheets using Apache POI SS
Java
Workbook wb = new HSSFWorkbook();
wb.createSheet("new sheet");
wb.createSheet("second sheet");
Sheet cloneSheet = wb.cloneSheet(0);
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.