Read range and write a data column

Hi All,

I have built a sequence that reads a range from a spreadsheet and creates a data table (dt) , I want to write a column next to it that is a unique ID example starts from 1000000 and increments 1 for every row.

E.G :
Read Range -> dt


After I add a column it needs to be the following

I am sharing the flow I created below:
flow is creating only 1 value and not identifying that the dt1 has 3 rows.

I also tried the following flow: The ID is not created

Can you please help me with pointing to the correct functions or share the logic I need to create.


Adding column is done only once in your case.I think looping with foreach for every row in the table and then assigning value to the new column created would solve your issue.

For each does not seem to work:

Hi @saivig
If you want to add a new column to the data table, then you have to write the data table back to the excel file. The previous data may loss and the new data table will be over written to the particular range.
In order to overcome this problem we can use write cell activity just to write to the required cells in that excel file.
Check this logic may be this is what you want to do. I have attached both the screenshot and XAML File also. Please have a look.

DataTableCounter.xaml (9.9 KB)


1 Like

Thanks @jibanjyoti Jiban … the sequence works :slight_smile:

Hi @jibanjyoti

The sequence works fine but seems to skip the last cell , if I populate 10 cells - it auto generates the first 9 and skips the last or skips the first depending on the counter start 2 or 1/

Any advice on how the counter should be tweaked ?


Hi @saivig if you dont have headers in you excel file then you can change the Counter1 value to 1 as it is writing from D2 in current code, and you dont have headers so it should write from D1.