How to Perform different actions for each line item in Excel based on some condition or any column value

How to Perform different actions for each line item in Excel based on some condition or any column value?

  1. I want to update excel for each line item(row) present in excel based on some condition.i.e., the bot should pick one row perform some actions based on condition or column value and update another column with a message . Then it should go to second row and it should perform different action based on column value and update different column. Like that it should continue.
  2. I am new here in UiPath. Excuse me if i am asking any silly question.Please help me out to learn these scenarios. Thanks in Advance :slight_smile:

@Swetadurba Welcome to out UIPath Community. Below steps will help you

  1. Use Read Range and put your excel data into datatable
  2. Use For Each row yo iterate over datatable rows and based on the column condition e.g. row.Item(“ColumnName”).ToString=“SomeCondition” write back your data into Excel using Write Cell using rowCounter variable which will be incremented in each loop

Thanks alot for your reply. will definitely try this. how ever i have to perform sap automation based on conditions. can i use for each row? and for rowCounter i have to write logic as count increment or is there in method for that? Thanks in advance.:slight_smile:

@Swetadurba Inside for each row put your sap logic and for rowCounter if you don’t want to use it then have all the processed row info in datatable and at the end of for each row use write range activity.

1 Like

Okay i will try this for sure and update here. Thanks @Arpit_Kesharwani

1 Like

Hi, I tried according to your steps. this is giving me correct output but the process is not completely working fine. after writing cell the desired output is getting printed outside of the rows. My scenario is:

  1. i have scraped a data from sap screen and stored it in Lock variable.
  2. if the lock variable contains 128 then process should perform some action for that row item and come back and then the same operation for second line item and so on.
  3. if lock variable contains 64 then it should update a column with value and come back and perform for the 2nd line item and so on.
    4.after checking for both conditions it should update the datatable and stop the workflow.
    Here i am attaching the workflow, Requesting you Please check and help me out where i am doing wrong. :slight_smile: :slight_smile:

I am sorry but i am not able to upload any xaml file screenshot. Not allowing for new users…

@Swetadurba outside of rows means what?

means suppose i have 2 rows, then it is printing on 20th row where no data is there

@Swetadurba you are using write range or write cell?
Whatever range value you will pass to activity it will write on that range only

write range activity i am using

Thanks alot for your help. I am able to do the task correctly now.

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