We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to loop through cells of a column

Is there any way to loop through cells of a particular colum.

For examle:

Looping the cells of column 4 in a sheet without using the range variables


Please see the sample code for your reference for your needs:
Workbook workbook = new Workbook(“e:\test\Book1.xlsx”);
Worksheet sheet = workbook.Worksheets[0];
Cells cells = sheet.Cells;
//Get the last cell in the 4th column (D)
Aspose.Cells.Cell endCell = cells.EndCellInColumn(3);
//Last row to loop through for D column
int maxrow = endCell.Row;
string val1;
for (int i = 0; i <= maxrow; i++)
val1 = cells[i, 3].StringValue;

Thank you.