Combine Multiple Workbooks into a Single Workbook with Node.js via C++
Combining Workbooks with Images and Charts
The example code combines two workbooks into a single workbook using Aspose.Cells for Node.js via C++. The code loads the source workbooks, uses the Workbook.combine(Workbook) method to combine them, and saves the output workbook.
Source Workbooks
Output Workbooks
Screenshots
Below are screenshots of the source and output workbooks.
The first worksheet of the charts workbook - stacked
Second worksheet of charts workbook - line
First worksheet of the picture workbook - picture
All three worksheets in the combined workbook - stacked, line, picture
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Define the first source
// Open the first excel file.
const sourceBook1 = new AsposeCells.Workbook(path.join(dataDir, "SampleChart.xlsx"));
// Define the second source book.
// Open the second excel file.
const sourceBook2 = new AsposeCells.Workbook(path.join(dataDir, "SampleImage.xlsx"));
// Combining the two workbooks
sourceBook1.combine(sourceBook2);
const outputPath = path.join(dataDir, "Combined.out.xlsx");
// Save the target book file.
sourceBook1.save(outputPath);