using Syncfusion.XlsIO;
using System.IO;
using System.Reflection;
namespace MergeExcelFiles
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initialize ExcelEngine
            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Initialize Application
                IApplication application = excelEngine.Excel;
                //Set default application version
                application.DefaultVersion = ExcelVersion.Excel2013;
                //Open existing workbooks with data entered
                Assembly assembly = typeof(Program).GetTypeInfo().Assembly;
                Stream fileStream1 = assembly.GetManifestResourceStream("OrderStatus1.xlsx");
                IWorkbook workbook1 = application.Workbooks.Open(fileStream1);
                IWorksheet worksheet = workbook1.Worksheets[0];
                Stream fileStream2 = assembly.GetManifestResourceStream("OrderStatus2.xlsx");
                IWorkbook workbook2 = application.Workbooks.Open(fileStream2);
                Stream fileStream3 = assembly.GetManifestResourceStream("OrderStatus3.xlsx");
                IWorkbook workbook3 = application.Workbooks.Open(fileStream3);
                //The content in the range A1:C8 from workbook2 and workbook3 is copied to workbook1
                int lastRow = worksheet.UsedRange.LastRow;
                workbook2.Worksheets[0].UsedRange.CopyTo(worksheet.Range[lastRow + 1, 1]);
                lastRow = worksheet.UsedRange.LastRow;
                workbook3.Worksheets[0].UsedRange.CopyTo(worksheet.Range[lastRow + 1, 1]);
                worksheet.UsedRange.AutofitColumns();
                //Save the workbook
                workbook1.SaveAs("Output.xlsx");
            }
        }
    }
}
Error Message:
Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: stream at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelOpenType openType) at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream) at MergeExcelFiles.Program.Main(String[] args) in C:\Users\test\Desktop\MergeExcelFiles\MergeExcelFiles\Program.cs:line 24
Note: I have set the build action for all the files as Embedded Resource. These files contain thousands of rows. Will that be an issue, causing this error? The same code is working fine with different files.
 
    