Combine Multiple Excel Ranges in C#
using IronXL;
using System;
using System.Linq;

WorkBook workBook = WorkBook.Load("sample.xls");
WorkSheet workSheet = workBook.WorkSheets.First();

// Get a range from an Excel worksheet
var range = workSheet["A2:A8"];

// Combine two ranges
var combinedRange = range + workSheet["A9:A10"];

// Iterate over combined range
foreach (var cell in combinedRange)
{
    Console.WriteLine(cell.Value);
}
NuGet Download
PM > Install-Package IronXL.Excel
Combine Multiple Excel Ranges in C#

Combine Multiple Excel Ranges in C#

IronXL is a C# library that allows for efficient manipulation of Excel files. One of its features is the ability to combine IronXL.Range objects using the + operator.

Using the + operator to combine IronXL.Range objects is a versatile way to handle multiple ranges as a single entity. This can be incredibly useful in scenarios requiring the aggregation of data from various sections of a worksheet.

Explore How to Write to Excel with IronXL
View on GitHub

Ready to Get Started?

Nuget Downloads 2,362,812Version:2026.11just released