How to get last used cell +1 number from specific column


I am trying to update the data into one column and for that I need to get the last used cell reference +1 number.
Ex. My A Column have data till A14 and my Q column have data till Q9. So in this case my task is to start updating the data from Q10.

I have used Read range activity but which give me entire table count that is 14 and I want on Q column count.

I have tried with below activity also which is working fine if there is data available after Header but gives error if there is no data after Header.

1 Like

You can try Append Range activity and see if it’s what you’re looking for.

Hope this expression would help you resolve this

This gives the last row and column cell value

dt.Rows((From row in dt.AsEnumerable() Select Convert.Tostring(row(“last_ColumnName”))) .ToList().Count-1)(“last_columnname”)

To have the row index alone have this expression alone
(From row in dt.AsEnumerable() Select Convert.Tostring(row(“last_ColumnName”))) .ToList().Count-1

Cheers @nilesh.mahajan

Hi @nilesh.mahajan

Use For Each Row in Data Table Activity
If Condition

Refer to the screenshot


You can use a read range activity with “Q” as the range in to a datatable
datatable.rows.count+1 will give you that cell index

readin the excel with read range - dtData

Assign activity
LHS: idxLast | Int32

dtData.AsEnumerable.ToList.FindLastIndex(Function (x) Not (isNothing(x(colNameOrIndex)) OrElse String.IsNullOrEmpty(x(colNameOrIndex).toString.trim)))

later add an offset for the excel first row (headers when used) + 1 as returne index is zero based