This demo uses the DevExpress Spreadsheet Document API to merge multiple workbooks into a single file. You can merge predefined sample files or supply your own documents. To do the latter, select Upload a File in the file selection drop-down menu and upload files one at a time.
Use the Merge and Save as... dropdown button to select the output format, merge workbooks, and download the result.
Sample document
InvestmentPortfolio.xlsx
DocumentForProtection.xlsx
using DevExpress.Spreadsheet;
Stream MergeWorkbooks(List<Stream> inputStreams, DocumentFormat outputFormat) {
using var finalWorkbook = new Workbook();
finalWorkbook.LoadDocument(inputStreams[0]);
for(int i = 1; i < inputStreams.Count; i++) {
using var currentWorkbook = new Workbook();
currentWorkbook.LoadDocument(inputStreams[i]);
finalWorkbook.Append(currentWorkbook);
}
var outputStream = new MemoryStream();
finalWorkbook.SaveDocument(outputStream, outputFormat);
outputStream.Position = 0;
return outputStream;
}