Description:I need to iterate through a single row where I don’t know the end range as I have a dynamically generated excel file which might have different number of columns used every time. I am using following code, taken from reference code
List<string> myValue = new List<string>();
//unknown end Range
//need to get the Last data filled column or Last Column used in the following line
string endRange="D1";
foreach (Range row in sheet.Cells.Rows.Range["A1", endRange])
{
Range cell = (Range)row.Cells[1, 1];
if (cell.Value2 != null)
{
myValue.Add(Convert.ToString(cell.Value2));
}
}
Posted by: Peter Andre | Posted on: Jan 22, 2020
3
Replied by: Umer khan | Replied on: Jan 23, 2020