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 SortAscending(), SortDescending(), Sum(), Max(), Min(), 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.

Range

Use var range = sheet["A2:A8"] to select range from A2 to A8.

Row

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.

Column

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

  1. Install C# library to select Excel range
  2. Load existing or generate new Excel workbook
  3. Select the targeted worksheet from the workbook
  4. Use workSheet["A2:A8"] to select range from A2 to A8
  5. Use GetColumn and GetRow methods to select individual column and row