Dynamically Add 3 new columns to a data table and update the table based on a condition

Hi All, I am trying to add 3 new columns with headers to an existing data table and also write to the excel in those columns based on a condition. So i have:

  1. Excel Scope
  2. Read Range
  3. Insert/Delete Columns.
    Then it has to go through other processes and based on those results: if the user Id is found then:
    1. write “complete” in the Status column (the new column 1),
    2. write “todays date” in the Date column (new column 2),
    3. write “yes” in the PreExisting column (new column 3)

Also i need to loop through each row with the 3 write cells. Right now it does not loop through any cells and it writes the data outside of the correct column.

You can follow below logic:

Foreach row in YourDataTable
{
if(hasUserID)
{
assign: row(“Status”) = “complete”
assign: row(“Date”) = Now.ToString
assign: row(“PreExisting”) = “yes”
}

}

1 Like

Hi @Laura2

Please find the attached xaml file for your reference. Please try this and reach us at any time if you have doubts. Thanks.

Testing.xaml (10.5 KB)

Happy Automation

Perfect. Thank you!

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