Excel Automation: Change the Status While Executing Task

HI,
I have excel file which have 3 column and 10 rows and which 3 columns Name as status.
how to get each row data to do some task and Write the specific Status as “Task Succesful”- if Task Completed and “Task Unsuccessful”- if task not completed.
Can someone help me with doing this type of task?

Thanks & Regards
Ravi Gupta

@ravi_gupta,

  1. Use Read Range activity to read data from excel and will give output as DataTable.
  2. Then iterate it using For Each Row activity.
    int index = DataTableName.rows.indexOf(row) + 2
    If row(“column1”).Tostring is something AND row(“column2”).Tostring
    Then perform something and get result
    If result is success then use Write cell activity and specify
    Range: “C”+index.Tostring
    Value: Task Succesful
    Else
    Range: “C”+index.Tostring
    Value: Task Unsuccesful

Can You Share a .xaml File for that I am little bit Confuse in 2nd Point Please Can u Me With It .
I am new UiPath.

Thank You.

@ravi_gupta,

sure. Please find the attached workflow. Here, I did like if column1 value is equal to column 2 value then it will write task successful else unsuccessful.

If you have any doubts then please let me know.

Excel_test.zip (7.9 KB)

1 Like

Hey it worked But Can u Explain This Code what it Means DT.Rows.IndexOf(row)+2

1 Like

@ravi_gupta,

By default, Index will start from 0. And also we won’t write anything in column header. So, we have to add +2 then it will start write from 2nd cell onwards.

1 Like

Its was very Helpful.

Thank You.

1 Like

Hi Ravi,

I think something like this:

Logic:

  1. Add excel scope
  2. Read range
  3. Iterate row - For each row
  4. Get row item
  5. Add If condition and check
  6. If Yes - Write Cell - check column index add status - Yes
  7. else then Write cell- check column index add status - No

Hope it would help you :slight_smile:

Leeladhar

I didnt’t get that about Get row items Used in it can u Share a File

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