SpreadsheetMerger.Process

Process(string[], string)

Merge given template files.

public static void Process(string[] templateFiles, string resultFile)
ParameterTypeDescription
templateFilesString[]The template files to be merged
resultFileStringThe resultant file

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.LowCode;
    using System;

    public class SpreadsheetMergerMethodProcessWithStringArrayStringDemo
    {
        public static void Run()
        {
            // Create sample template files
            CreateTemplateFile("template1.xlsx", "Data from Template 1");
            CreateTemplateFile("template2.xlsx", "Data from Template 2");

            string[] templateFiles = { "template1.xlsx", "template2.xlsx" };
            string resultFile = "merged_output.xlsx";

            try
            {
                SpreadsheetMerger.Process(templateFiles, resultFile);

                Console.WriteLine($"Process method merged {templateFiles.Length} files into {resultFile}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error executing Process method: {ex.Message}");
            }
        }

        private static void CreateTemplateFile(string fileName, string cellValue)
        {
            Workbook workbook = new Workbook();
            workbook.Worksheets[0].Cells["A1"].PutValue(cellValue);
            workbook.Save(fileName);
        }
    }
}

See Also


Process(LowCodeMergeOptions)

Merges multiple template files into one.

public static void Process(LowCodeMergeOptions options)
ParameterTypeDescription
optionsLowCodeMergeOptionsOptions for merging files

See Also