Filling the SNO in the Excel sheet

Hi Team, Can any one help me that how can I able to fill the SNO and Date in a addd data row activity for each iteration.

Let us consider I am getting the value in the name section, so in finaaly i have to upodate the sheet with SNO and Date.

image

For each iteration I want to fill the SNO as 1,2,3,4… till my bot iterate.

Thanks

@srinusoft37

SNO column you want to update it sequentially and what about Date column ?

can you be a little specific. SNO column you want to update it sequentially means, can u help me in creating the xaml file for this,

Date I can able to update

Thanks

@srinusoft37

Try below steps.

  1. Use Read Range activity to read the data from excel file and it will give output as DataTable. Let’s say dtInput.

  2. Initialize one integer variable as below.

         Int SerialNumber = 1
    
  3. And then use For Each Row activity to iterate one by one row.

For Each row in dtInput
 use Add DataRow activity and pass ArrayRow and DataTable as below.
    ArrayRow: {SerialNumber,date,row("Name").ToString}
    DataTable: dtInput
       SerialNumber = SerialNumber + 1
  1. Finally use Write Range activity and pass dtInput to write data back to the excel file.

Hello,

Please check out this solution. It’s the same requirement as yours.

Thanks!
Athira

For Each row in dtInput
use Add DataRow activity and pass ArrayRow and DataTable as below.
Create a Build data table , and the output is DTInput1
ArrayRow: {SerialNumber,date,row(“Name”).ToString}
DataTable: dtInput1
SerialNumber = SerialNumber + 1

This will work

Thanks

@srinusoft37

You should Mark the appropriate post as solution but not your post :sweat_smile:

Actually my post is the answer, so I did this

Thanks

@srinusoft37

Actually I provided these steps in my previous post and you just added Build DataTable activity in between.

In your case, it’s not required as you have DataTable already and also we can’t use this activity inside For Each Row activity. If do so then it will create new DataTable for each iteration.

Agree, but if we are using the same data table all the values are appending in the append range, so I added the one build dtata table…

Ok I will change the solution for your post

Thanks

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