Copy Excel Worksheets
The code example above shows how to use IronXL to duplicate and copy WorkSheets
within and between Excel WorkBooks
. Copy and paste sheets to and from other workbooks. Create duplicate sheets within the same workbook.
CopySheet
method is used to duplicate worksheet within the same workbook or spreadsheet. The name of the new worksheet is required as parameter.
Use CopyTo
method to duplicate sheet to or from another workbook. WorkBook
is required as the first parameter and follows by the name of the new worksheet.
You can download a file project from this link
How to Copy Excel Worksheets in C#
- Install an Excel library to copy worksheets.
- Load an Excel workbook and create a new sheet
- Use the
CopyTo
method to copy data to the new worksheet - Save the new Excel worksheet