How to add data to an Excel file based on a column?

Hello friends, I have an Excel file that looks like this


I want to add name and based on the location. How do I do this? I’m new to UiPath so, kindly help!!!

@Palaniyappan could you help me with this?

1 Like

Hi @cybzom

Use Build Datatable activity

Use add data row activity

ashwin S

@AshwinS2 I tried that but, it won’t be dynamic right? Can you share a .xaml file?

welcome to uipath community
Let me simulate this once and get back to you buddy
looks tricky
Cheers @cybzom

1 Like

Hi @cybzom,

you may get the result like below

the location field will not merge it that ok for you? if not its some what difficult to handle

Arivazhagan A

1 Like

Thank u…

Yes that’s ok but keep in mind that the data will be taken from an excel file and will be added here based on the location so, if the data I’m giving is D 23 Bangalore it should append after C where the location is Bangalore…

Thx for your help @arivu96 :slight_smile:

Then you can achieve easily.

  1. Use read range activity to get the data into Datatable(dt).
  2. dtNew=dt.clone() - create new data table variable
  3. Use For each row activity
  4. add one by one into new datatable
  5. before add check if first column value is “Bangalore”
  6. if yes add additional add data row to new datatable(dtNew).
    7.use write range activity to update the information into excel sheet.

Arivazhagan A

1 Like

@arivu96 will it be dynamic? and sir it would be so helpful if u can share a xaml file… pls… I’m new to UiPath… kindly help

HI @cybzom,

please refer the xmal file and sample excel file
Book1.xlsx (8.7 KB) Flowchart2.xaml (17.8 KB)

Arivazhagan A

1 Like

Thnx @arivu96… I will check this logic and let u know…thnx again :slight_smile: