How the bot will out from if condition

I have read excel sheet in sheet multiple dates are available and i have to run the bot which date is available in the sheet only but

The problem is bot is reading sheet properly which I have mention date it’s goin then condition and if the date is not match going else condition but bot is running only there it’s reading whole excel sheet

If the date is match the bot will run proceed

Hi @suraj_gaikwad

  1. Use the “Excel Application Scope” activity and specify the path to your Excel file.
  2. add the “Read Range” activity and specify the range or sheet name you want to read. Store the output in a DataTable variable, let’s call it “excelData”.
  3. Now, you can use a “For Each Row” activity to iterate through each row in the DataTable.
    4.Within the loop, you can access the date column using the column index or column name. For example, if the date column is the second column, you can use row(1) to access it. Let’s assume the date you want to match is stored in a variable called “desiredDate”.
  4. Add an “If” activity inside the loop and set the condition to check if the date in the current row matches the desiredDate. For example, the condition could be row(1).ToString = desiredDate.
  5. If the condition is true, it means the date matches. You can place your bot logic inside the “Then” block of the “If” activity.
  6. If the condition is false, it means the date doesn’t match. You can place any necessary logic for the else case inside the “Else” block of the “If” activity.

Hope it helps!!

1 Like


For that once the date is matched then use a break statement to break the loop and proceed further


1 Like

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