Create Union Range

Create Union Range

Aspose.Cells provides the ability to create Union Range by using the WorksheetCollection.create_union_range method. The WorksheetCollection.create_union_range method accepts two parameters, the address to create the union range and the index of the worksheet. The WorksheetCollection.create_union_range method returns a UnionRange object.

The following code snippet demonstrates creating a Union Range by using the WorksheetCollection.create_union_range method. The output file generated by the code is attached for reference.

from aspose.cells import Workbook
# Instantiating a Workbook object
workbook = Workbook()
# Create union range
unionRange = workbook.worksheets.create_union_range("sheet1!A1:A10,sheet1!C1:C10", 0)
# Put value "ABCD" in the range
unionRange.value = "ABCD"
# Save the output workbook.
workbook.save("CreateUnionRange_out.xlsx")