protected override void Execute(CodeActivityContext context) { var soursePath = SoursePath.Get(context); var sheets = Sheets.Get(context); var destinationPath = DestinationPath.Get(context); Workbook destinationWorkbook = null; Workbook sourseWorkbook = new Workbook(soursePath); if (!File.Exists(destinationPath)) { destinationWorkbook = new Workbook(); //destinationWorkbook.Worksheets.Add("Sheet1"); destinationWorkbook.Save(destinationPath); } destinationWorkbook = new Workbook(destinationPath); foreach (KeyValuePair <string, string> item in sheets) { destinationWorkbook.Worksheets.Add(item.Key).Copy(sourseWorkbook.Worksheets[item.Value]); } destinationWorkbook.Worksheets.RemoveAt("Sheet1"); destinationWorkbook.Save(destinationPath); }