Uipath AUto update value in excel file

Hi expert

how can i write a cell with 3 conditions to filter?

i tried to use lookup range but the activity requires excel formula, but i would like to use UiPath Activity to update it.

i would be using main list Excel file 1 columns ‘Tel Num’, ‘Date 1’ and ‘Date 2’ details to compare daily list Excel file 2 columns based on the 3 conditions. Both excel files are having the columns and would need update the remarks column excel file 1 when both rows are match.

In excel file 2,the columns tel num would be unique and date 1 would have different dates. E.g. tel num Col having “546” and date 1 could have 2 rows ‘1 Feb’ and ‘5 may’ then date 2 could be ‘23 Feb’ and ‘6 jun’. So when daily excel file 2 is having tel num ‘546’, date1 ‘5 may’, date2 ‘23 Feb’ then UiPath would update the ‘remark’ col with todays date as latest modified in excel file 1

any expert knows how to do it ?

thanks in advance as i am stuck.

@Waka

Use a if condition and use the conditions in it…and this would be inside a for each row in datatable with first excel data and then for second excel…you can use the index property of for loop if the rowa are same …if sifferent use filter datatable to filter dt2 amd check if matching or not

Cheers

Hi @Waka

Try this way

I hope it helps!!

Hi @Anil_G

Not really understand as I’m not programmer. Do we have a simple ways to update it?

@lrtetala Hi I tried this method but it didn’t goes it as what I want.

@Waka

The steps would be like this

  1. Read the data from excel2 where you have data but no update is needed into dt
  2. Use excel file activity with excel1 and use for each row in excel activity
  3. Inside the loop use a filter datatable on dt and filter the columns you want to compare with the value from the excel1…currentrow.ByField("ColumnName").Value will give the value from excel1 which is to be used in filter datatable activity to filter the dt and store output in filtereddt
  4. Use if condition with filtereddt.Rowcount>0
  5. On then side data ia matched and on else side it is not …update the data using write cel accordingly in where to write give currentrow.ByField("Columntoupdate")

Cheers

@Anil_G

I tired using your method logic,however the logic did not get the correct excel position to write on the correct cell position. My bad

1 Like

@Waka

I hope you meant it worked right?

Hope it works …if not do let us know we can further check what is the difference

Cheers

@Anil_G

My bad. The script did not update in the correct row in the remarks column as it only update the first record remarks instead.

@Waka

Can you show your code once …a screenshot would help

Cheers

@Anil_G

Here is go. I managed to use the filter data table and if conditions to get 2 rows counts out of the list that are having the same tel num.

@Waka

I dont see the write cell part where you say it is failing

Also are you jot on modern excel activities?

Cheers

@Anil_G

Im trying to find the excel index position first and I’m not in modern excel activity.

@Waka

If you are in for loop of first exce then why are you using look up ramge?

For loop has an index property that can be used to get the row number

Cheers

@Anil_G

The row index does not tell where is the remarks column position in excel file 1. The row index only managed to get the first row of data table and update the remark the remark column in excel file 1

@Waka

  1. As per your write cell screenshot i can see the column is already J …so ypu dont need to column…and as far as row is concerned…for loop index will increment as a zero based index and it would give the index properly…please check you code there might be a need to add a number like 2 or so to the index to get the correct row

Cheers

@Anil_G

i would need the write cell is not how can i update the excel file 1 without using write cell ?

i am trying to match the data in excel file 2 with excel file 1, and if the data row with the same tel num, date 1 and date 2 then excel file 1 will update remarks column with today’s date.

the screenshot is the outcome i am trying to achieve. since tel num = 534563 is having the same and the difference is date 2 so the process should compare in such a way that if tel num and date 1 or date 2 are not the same will update the remarks column with today’s date.

@Waka

  1. I am not saying you dont need write cell…I am saying the column is something you know and row index will be obtained from for loop index property
  2. In whichever file you want to update the remarks loop on that related datatable …
  3. From which wvwr file you want to only compare but not update…filter that datatable inside loop
  4. So now what happens is the loop will loopthrough each row and filter will filter only the required data as it is looping the row index changes for each row and you will mnow which row it is

The same is explained in my previous comment as well…no lookup would be needed again

Cheers

@Anil_G

how can i do about it ? based on the screenshot shared by me. the flow only allow me to update the row 2 and remarks cols, and it did not update the row 13 remarks columns with today’s date

@Waka

What is being looped in your for ? Is it your excel 1?

And are you using filter datatable on excel2 i dont even see it in acreenshot

Cheers