Hi, Iβm using delete range activity but I wish to make it dynamic. is there anyway we can delete all the written rows only instead of giving specific range.
thanks in advance for helping me
Hi, Iβm using delete range activity but I wish to make it dynamic. is there anyway we can delete all the written rows only instead of giving specific range.
thanks in advance for helping me
You can use as below
DatatableVariable.Rows.Count
This will give you all the rows available
You can use as βAβ + DatatableVariable.Rows.Count : βDβ + DatatableVariable.Rows.Count
If you have header for the first row then you can add +2
Hope this will help you
Thanks
Hi
Hope the below steps would help you resolve this
Say for example the number of rows and number of columns are dynamic
In that case we can first read the excel with READ RANGE activity and get the output as datatable dt
Now use a Assign activity like this
Int_rowcount = dt.Rows.Count
And another assign activity like this
Int_colcount = dt.Rows.Count
Where both int_rowcount and int_colcount are of type int32
Condition will be like
int_colcount < 26
If the above condition is true it goes to THEN Block where use a Delete range activity
With range mentioned like this
βA2β+β:β+Convert.ToChar(65+(dt.Columns.Count-1) ).ToString+(dt.Rows.Count+1).ToString
If the if condition is false it goes to ELSE block where use a delete range activity with range mentioned like this
βA2β+β:β+βAβ+Convert.ToChar(65+(dt.Columns.Count-1) - 26 ).ToString+(dt.Rows.Count+1).ToString
Reason to keep βA2β at start is to keep the header
If you donβt want then mention as βA1β instead
So that it delete the entire excel data
Cheers @Dmitri00007
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.