Combine Multiple Workbooks into a Single Workbook

Combining Workbooks with Images and Charts

The example code combines two workbooks into a single workbook using Aspose.Cells for Python via .NET. The code loads the source workbooks, uses the Workbook.combine() 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

todo:image_alt_text

Second worksheet of charts workbook - line

todo:image_alt_text

First worksheet of the picture workbook - picture

todo:image_alt_text

All three worksheets in the combined workbook - stacked, line, picture

todo:image_alt_text

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Define the first source
# Open the first excel file.
SourceBook1 = Workbook(dataDir + "SampleChart.xlsx")
# Define the second source book.
# Open the second excel file.
SourceBook2 = Workbook(dataDir + "SampleImage.xlsx")
# Combining the two workbooks
SourceBook1.combine(SourceBook2)
dataDir = dataDir + "Combined.out.xlsx"
# Save the target book file.
SourceBook1.save(dataDir)

Advance topics