Search code examples
c#excelepplus

Copy Excel worksheet from another file


I have an empty Excel worksheet with some cells being merged, custom width x height, etc. I am using EPPlus with C# to interact with Excel files. How do I achieve this: Copy the excel worksheet from that file as it is to another file, maintaining cells formatting and everything as it is?


Solution

  • In c# : use worksheet.copy as illustrated here: https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Cells/How-to-Duplicate-a-Row-in-Excel-in-C-VB.NET.html

    In epplus: similarly, as described here: how to copy ExcelWorkSheet from template with new CodeModule