Read range in excel

Hi, how can I read data from excel? I need a condition that if column X contains Y then perform an action.

Hi @sullivanne

containsY = dt.AsEnumerable().
                            Any(Function(row) row("X").ToString().Contains("Y"))

If containsY Then
    ' Perform your action here
End If

Regards,

Hi @sullivanne

Read range workbook    //store output in dtExcelData datatable
For Each row in dtExcelData
    If row("ColumnX").ToString.Contains("Y")
    Then
        // Perform your action here
    End If
Next

1 Like

Read range(dt-DataTable)

For each row in data table(dt-DataTatble)

row(“Column x”).tostring
if[row(“Column x”).tostring.Contains (“y”)]
then
else

1 Like

Hi @sullivanne

You can use the LINQ Expression to check the condition. First, use the Read range workbook activity to read the excel and store in a datatable called DT.

Then use the below expression in If condition,

- Condition -> DT.asenumerable.Any(Function(row) row("Column name").toString.equals("Y"))

→ If Y contains in the Column X then bot will go to Then block.
→ If Y does not contains in Column X then bot will go to else block.

Hope it helps!!

1 Like

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