Select Excel Range
IronXL allows us to easily select and work with ranges in any Excel
WorkSheet. The code above demonstrate how range, row, and column can be easily selected. With IronXL it is possible to apply further sorting or calculation with this collection of data such as
Avg(). However be mindful that when applying method that modify or move value of the cell. The affected range, row, and column will also update it's value accordingly.
var range = sheet["A2:A8"] to select range from A2 to A8.
To select row 1 use the method
GetRow(0). The indexing follows zero-based numbering. The range of cells will be determined by the union of populated cell of all the row including row 1 itself.
To select column A use the method
GetColumn(0) or assign the range address as
sheet["A:A"]. The range of cells will be determined by the union of populated cell of all the column including column A itself.
How to select Excel Range in C
- Install C# library to select Excel range
- Load existing or generate new Excel workbook
- Select the targeted worksheet from the workbook
workSheet["A2:A8"]to select range from A2 to A8
GetRowmethods to select individual column and row
You can download the software product from this link.