How to increase Counter dynamically

I have an excel sheet which has an SNo.

I have chosen auto-increment but the execution-only works once so the counter remains zero all the time at the next execution the counter will be the same.

I need my activity should be organized in which It should read the previous column and from there it should add +1 to that so that every time there is a new line there should be +1 in the columnAnnotation 2020-11-22 232555

Hi @Rahul_Singh_Kamboj

Welcome to forum

So when u are running it one time u are inserting new records

So let’s say previously u had 5 records

So the SI No was 5 at latest record

So at the beginning of workflow use the following to get the next SI No automatically added in next cell

  1. Use read range to read the excel file and store in dt1
  2. Use read cell activitiy to read the latest SI No in excel sheet for that

Specify the cell as “A”+(dt1.Rows.Count+1).ToString and store the output from read cell in a variable , so now u get the value of previous SI No

Now u can use write cell activitiy to write into next cell with value increment by 1 and cell as
“A”+(dt1.Rows.Count+2).ToString

Hope the above logic helps you

Mark it as solution if it helps

Regards

Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile::slight_smile:

Hi @Rahul_Singh_Kamboj did u increment the value when u add in the next row using write cell activitiy?

Hi @Rahul_Singh_Kamboj sorry for delayed response
check this one
sample.xaml (6.1 KB)

Hope it helps you
Regards
Nived N
Happy Automation

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.