Copy Worksheet

Aspose.Cells - Copy Worksheet

C#

 //Create a new Workbook from an Excel file path
Workbook wb = new Workbook("../../data/workbook.xlsx");

//Create a Worksheets object that references the sheets of the Workbook.
WorksheetCollection sheets = wb.Worksheets;

//Copy data to a new sheet from an existing sheet within the Workbook.
sheets.AddCopy("Sheet1");

wb.Save("../../data/workbook.xlsx");

NPOI - HSSF XSSF - Copy Worksheet

C#

 IWorkbook wb = new XSSFWorkbook();

wb.CreateSheet("new sheet");

wb.CreateSheet("second sheet");

ISheet cloneSheet = wb.CloneSheet(0);

FileStream sw = File.Create("newWorksheet.xls");

wb.Write(sw);

sw.Close();

Download Running Code

Download Copy Worksheet from any of the below‑mentioned social coding sites: