How to replace a data from specific columns to specific

Hi Everyone,

I have to replace data yes to pending but
Sone specific columns

Ex column1 column2 column3 column4. column5

Column3 to columns5

Thanks

Hi @suraj_gaikwad

Try with Find/Replace Value activity

Regards,

Steps to Replace “Yes” with “Pending” in Specific Columns:

Read the Excel file using the “Read Range” activity (Store in dtData).
Loop through each row using “For Each Row” activity.
Modify values in specific columns (Column3 to Column5).
If row(“Column3”).ToString.Trim.ToLower = “yes” Then
row(“Column3”) = “Pending”
End If

If row(“Column4”).ToString.Trim.ToLower = “yes” Then
row(“Column4”) = “Pending”
End If

If row(“Column5”).ToString.Trim.ToLower = “yes” Then
row(“Column5”) = “Pending”
End If
Write back to Excel using “Write Range”.

Hi @suraj_gaikwad

You can use the below LINQ Expression to replace the yes with pending in specified 3 column,

- Assign -> dt_Output = (From row In dt_Input.AsEnumerable
                         Let Column3Value = If(row("Column3").toString.tolower.equals("yes"), "pending", row("Column3").ToString)
                         Let Column4Value = If(row("Column4").toString.tolower.equals("yes"), "pending", row("Column4").ToString)
                         Let Column5Value = If(row("Column5").toString.tolower.equals("yes"), "pending", row("Column5").ToString)
                         Select dt_Input.Clone.Rows.Add(row("Column1"), row("Column2"), Column3Value,Column4Value, Column5Value)
                                    ).Copytodatatable()

Note: Change the column names based on your input data.

Hope it helps!!

@suraj_gaikwad

please elaborate the ask or show some input and output template

else let us know what you tried and if you are facing any issue

cheers

Thank you everyone

@lrtetala
@Ruhi_Sayyad
@mkankatala
@Anil_G

3 Likes

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