IronXL allows us to easily select and work with ranges in any Excel WorkSheet
.
C#:
using System.Linq;
using IronXL;
WorkBook workbook = WorkBook.Load("test.xls");
WorkSheet sheet = workbook.WorkSheets.First();
//This is how we get range from Excel worksheet
var range = sheet["A2:A8"];
//This is how we can iterate over our range
foreach (var cell in range)
{
Console.WriteLine(cell.Value);
}
VB:
Imports System.Linq
Imports IronXL
Private workbook As WorkBook = WorkBook.Load("test.xls")
Private sheet As WorkSheet = workbook.WorkSheets.First()
'This is how we get range from Excel worksheet
Private range = sheet("A2:A8")
'This is how we can iterate over our range
For Each cell In range
Console.WriteLine(cell.Value)
Next cell
Top comments (0)