We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Copy Worksheets between Workbooks

How can i copy a Worksheet between two Workbooks? I am trying to do it like this

var mainWb = new Workbook($"MainPath");
var tempWs= mainWb.Worksheets[2];

var tempWb = new Workbook($"{FilePath}");

Why isn’t this working?


Thanks for the code segment.

Please try using Worksheet.Copy() method to copy worksheets b/w workbooks, see the document with example code for your reference:

Hope, this helps a bit.

Thank you @Amjad_Sahi for your answer!

My problem was that i forgot to save the tempWb… my fault I’m sorry…


Good to know that your issue is sorted out now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.