How to find the last empty row and column using excel application scope


I want to get the last empty row and last empty column in excel
Here is the one i have tried

I have used Read range activity and stores the data in the datatable.
To get the last empty row count, rcount = (datatable.rows.count+1).toString()
the same concept i have used for Column
Will this works all the time, please advise

Say if i want to get the last empty column in each row, How to achieve it


Yes it will work for rows.
Similarly you need to use DataTable.Columns.count to find last column.


Usually Count will start from 1 and Rows.Count will give total number of rows in a datatable
And if you
Want to get the last EMPTY rows then your expression with + 1 will work

Same way for columns

And if you just need column count alone and not the last EMPTY column then remove that + 1

This gives the column count

And for this

For each row you can get the last empty column or the count till which column that row has value
We can use this expression inside the for each row activity


CurrentRow is the variable name of for each row activity and ItemArray will convert that Datarow into array of elements and count will give the number of elements

If we know the number of element in a row and number of columns then we can match and find how many columns are filled

Hope this would help you

Cheers @Subha_Sundara_moorthi

Thanks, Have you designed it? If yes, please share the xaml file.