How to add static text in a row if column2 contains yes

I have 4 columns. In column2 if it containing yes value then it has to add column with text (mail it)
want to get like this below

Read the file using Use Excel File activity, Store this is in a datatable, Use add data column activity, and add the value

using assign

dt(“ColumnName”)= “Mail it”

Write the table back to excel using write datatable to excel activity

hi @vnsatyasunil

Read the data in a Datatable if there are multiple rows,
Add Data Column to the above read data Table using Add Data Column activity,
loop through all the rows using For each Row in DataTable,
put an if condition CurrentRow(“Status”).toString.toLower.contains(“yes”)
in the then section use an assign activity : currentRow(“Report”)= “mail it”.

Thank you!

Happy Automation! :smiley:

Hi @vnsatyasunil ,

You could try below:

  1. Build the ouputDT datatable with Name to report columns
  2. assign outputDT=
    From row In inputDT
    Let result=If(row(“Status”).tostring.trim.tolower=“yes”,“mail it”,“”)
    Select outputDT.rows.add(row(0).tostring, row(1).tostring,row(2).tostring,row(3).tostring,result)

this is not working. Can you help please?

What is the error?

Can you show us with a screenshot?

No error. data column is not adding in excel & value is not copying

I used read range workbook & after that add data column activity to add column to that datatable.
then used for each row in dt,
if currentRow(“Status”).tostring.contains(“Yes”)
then assign currentRow(“Reports”)=“mail it”

if current row is yes i need to enter one text & if it is no i need to enter another text in that added data column row

for assign activity error is exception has been thrown by target of an invocation

Debug the workflow please and share a screenshot. What have you written in Assign activity.

Also once you exit out of the loop you’ll need to write that datatable back in Excel using Write Range.

Hi @vnsatyasunil (152.9 KB)

Hope it helps!!