Replace column in a datatable with another column in another datatable

Hello,

I want to do a copy of a column from a specefic datatable to another

how to procede!?

Buddy @abdel
Great
Kindly follow the below steps that could resolve your issue ,

  1. open the excel with excel application scope

  2. Read the file with read range activity and assign the output to a variable of type datatable

  3. use a for each row loop to iterate through this datatable

  4. inside the for each row loop use an assign activity with left side a variable of type system.data.datacolumn, named out_column and right side like
    out_column = row(“the columnname you want to take”)
    or
    out_column = row(columnindex)

  5. once you got the data column now use add datacolumn activity

  6. there mention the input for
    datatable = new datatable you have
    column = out_column (the data column we have)…NOTE not in column name, its column

  7. Thats all buddy you are all done…

Hope this would help you

Cheers…!

but it will add a column to the new datatable, i want to replace old colum values

No worries buddy @abdel , in the same process as mentioned earlier after step 3

  1. assign a variable with the new value you want after processing them
    Inside the for each row loop use a assign activty like
    row(“existingColumnname”) = variable name (the value you want to put in that column)

Thats all buddy you are done
Cheers…!

1 Like

Did that work buddy…
@abdel