Add serial number column to excel file

Hi Team I have to add a column serial number which should start from 0. No need to add header to the column. I have around 600 entries in that data table. can anyone please help me

@Hiba_B

Hi
Hope the below steps would help you resolve this

  1. Let’s take like you have a datatable named dt

  2. Now use a ADD DATACOLUMN activity and pass the columnname as “FinalColumn” and datatable as dt
    I have mentioned in the next step on how to change this column name to value 0

  3. Now use a assign activity like

dt.Columns(“FinalColumn”).ColumnName = “0”

  1. Now use a FOR EACH ROW activity and pass dt as input

  2. Inside the loop use a assign activity like this

CurrentRow(dt.Columns.Count-1) = (dt.Rows.IndexOf(CurrentRow)+1).ToString

This will update the serial number till last 600th row

Cheers @abhide

1 Like

Thanks a lot for help but i am getting following O/P I want it as follows

CurrentRow(dt.Columns.Count-3) = (dt.Rows.IndexOf(CurrentRow)).ToString

After this it worked

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