Copy Sheet Within Workbook

Microsoft Excel - Moving or Copying Sheets within Workbook

Following are the steps involved for copying and moving worksheets within or between workbooks.

  1. To move or copy sheets within or between workbooks, open the workbook that will receive the sheets.
  2. Switch to the workbook that contains the sheets you want to move or copy, and then select the sheets.
  3. On the Edit menu, click Move or Copy Sheet.
  4. In the To book box, click the workbook to receive the sheets.
  5. To move or copy the selected sheets to a new workbook, click new book.
  6. In the Before sheet box, click the sheet before which you want to insert the moved or copied sheets.
  7. To copy the sheets instead of moving them, select the Create a copy check box.

Aspose.Cells - Copy Sheet Within Workbook

Copy sheets using Aspose.Cells


 //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.


Apache POI SS - Copy Sheet Within Workbook

Copy sheets using Apache POI SS


 Workbook wb = new HSSFWorkbook();

wb.createSheet("new sheet");

wb.createSheet("second sheet");

Sheet cloneSheet = wb.cloneSheet(0);

Download Running Code

Download Sample Code