Updating existing excel row

HI
i have three column in my excel sheet

name email date
micahel @gmail.com 25/5
mark @gmail.com 26/5
john @gmail.com 27/5

i want to update the mark email id and date with new data???/

Hi,

If you know the cell name and if its static then try β€œwrite cell” activity.
It writes a value into a specified spreadsheet cell or a range. If the sheet does not exist, a new one is created with the SheetName value. If a value exists, it is overwritten. Changes are immediately saved.

jan.xlsx (8.3 KB)

hey i attaching one excel sheet here

my requirement is like this
Id name 1 2 3 4…15…31
123 j L
124 k L

i getting all the data from my mail and inserting in excel

but if same id come again from my mail i just want to update the existing row not inserting

in here i just updating on day 3

ex 123 J day is 3
Id name 1 2 3 4…15…31
123 j L L
124 k L

Hi,

The Logic that I would use in this case is - Store the original excel is a datatable say, Originaldatatable, the new excel that i receive everyday in a new datatable say, datatablenew. Both the datatables should have the same columnnames.

Then use the datatable.Merge function. In UiPath, you can use the Invoke Method functionality, with the targetObject as Originaldatatable, Methodname as Merge, parameters collections having one In argument of type Datatable, and value datatablenew(As shown below)

This updates your Originaldatatable with the data in the datatablenew. You can then write it back to excel.

Let me know if you have any questions.

Regards,
Amrita

2 Likes

Hi i am reading my mail box and updating L in excel sheet dynamically which date employee apply for leave . if the employee apply for Cancel leave i just want to remove the L from the date dynamically

explain in detailjan.xlsx (8.2 KB)

Ok, in that case, you can do it using the following steps

  1. Read range on the excel β†’ save it to datatable_EmployeeLeave
  2. Read email and extract the Employee ID from the email and save in variable lets assume β†’ EmpID.
  3. Filter the datatable, datatable_EmployeeLeave using the datatable.Select(β€œ[Emp_id] = '”+EmpId.tostring+β€œ'”) using an Assign activity and assign the resulting Datarow array to a variable, say datarows_filter_byEmpID
  4. Depending on the date of leave applied by the employee, Eg, 6th, you can update your datatable using an assign activity, like datarows_filter_byEmpID(0)(β€œ6”) = β€œL” or if you want to cancel it, datarows_filter_byEmpID(0)(β€œ6”) = β€œβ€

I hope this answers your question. Let me know in case of any questions

Regards,
Amrita

3 Likes