Replacing a cell value "-" into another cell value "0"

Good Day,

I am trying to replace each row in Width column that has a value of - into 0. May I know the efficient solution where it can process thousand of rows quickly?

Kindly see picture below and the attached file for the sample file. Thank you.

image

SampleExcel.xlsx (9.1 KB)

Best regards,
Robert Russell Monsalud

1.Take Read Range Workbook Activity to read your excel data and create a variable = YourDataTable

2.Take Assign Activity

YourDataTable = YourDataTable.AsEnumerable().Select(Function(row)
{
row(“Width”) = If(row(“Width”).ToString() = “-”, 0, row(“Width”))
Return row
}).CopyToDataTable()

@RobertRussell_Monsalud

Hi,

How about Find/Replace Value activity?

img20231024-3

Sample
Sample20231024-1aL.zip (2.7 KB)

Regards,

Hi @RobertRussell_Monsalud
=> Use Read Range Workbook to read the Excel and store the Output in a variable say dt_data.
=> Use the below syntax in Assign activity:

dt_data = dt_data.AsEnumerable().Select(Function(row) 
{
    If row("Width").ToString() = "-", 
    Then 
        row("Width") = "0"
    End If
    Return row
}).CopyToDataTable

=> Use Write Range Workbook to write the data again back to excel.

Hope it helps!!

@RobertRussell_Monsalud

Step 1: Use read range (preferable workbook activity) store the output in dt_sample .
Step 2: use Invoke code activity with in_argument as the datatable variable as shown below
Step 3:Add the following code in edit code:
In_Dt_Sample.AsEnumerable.ToList.ForEach(Sub(x)
If(x(“Width”).toString=“-”)
x(“Width”)=“0”
End If
End Sub
)

image