Copy Worksheet
Contents
[
Hide
]
Aspose.Cells - Copy Worksheet
C#
//Create a new Workbook by excel file path
Workbook wb = new Workbook("../../data/workbook.xlsx");
//Create a Worksheets object with reference to 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 form any of the below mentioned social coding sites:
For more details, visit Working with Worksheets.