Merging data from two excel files

Hi UiPath community,

I got two excel files with company names and job descriptions and I want to merge these two files together into one file.

Cheers and thanks,
Sevan

1 Like

Hi
welcome to uipath community
did we try with MERGE DATATABLE ACTIVITY
kindly check this thread pls

Cheers @Sevan

1 Like

Thanks for the quick respone :slightly_smiling_face:
No I haven’t, do you have more detailed instructions how to use the function? As I understood right I have to create two output tables with variables.
I’m from the finance area and just started learning UiPath last week in a Udemy class.

1 Like

no worries
that document tells us in described way and also has an example in it
–two get datatable of two excel files use EXCEL APPLICATION SCOPE with filepath as input for first excel and inside that scope use a READ RANGE activity and mention the range as “” and sheetname and get the output with a variable named dt1

–again same to be repeated for second excel file and variable named as dt2

–now as per that document example we canperform the merge datatable activity

kindly try this and let know for any queries or clarification
Cheers @Sevan

Cheers Palaniyappan!
Sounds reasonable. Let me try that one :slight_smile:

1 Like

Hi Palani,
Thanks for your help. I’m stucked here in a problem.
I have structured my sequence as follow:
1.1. excel application scope with my first excel file
1.2. excel application scope with my second excel file
1.3. build data table for my DT1
1.4. build data table for my DT2
1.5. sequence
1.5.1. Merge data table => and here I get an error :frowning:

The only output variables that I have created are in the read range activity as described above.

Is there an error in my logic?

Cheers, Sevan

Hi
hope these steps would help you resolve this
–use a EXCEL APPLICATION SCOPE and pass the filepath of first excel and inside that scope use READ RANGE activity and get the output with variable of type datatable named dt1
–then next to this scope activity use another EXCEL APPLICATION SCOPE and pass the file path of second excel and use read range activity and get the output with a variable of type dt2
–we dont need to use BUILD DATATABLE ACTIVITY
–next to this use MERGE DATATABLE activity where in the source mention as dt1 and in destination as dt2

now dt2 variable will have all the data merged together
and when we are using merge datatable we need to ensure these stuffs
like
–both datatable must have same structure of column
–both must have same order of column
–same datatype of column
–same number of columns

only then merge datatable activity will work

kindly try this and let know for any queries or clarification
Cheers @Sevan

2 Likes

Hi Palani,

Thank you very much for your help and merging the data worked :slight_smile:
I will try to create a new excel file tomorrow and will come back, if I need some help.

Cheers, Sevan

1 Like

Cheers @Sevan

Hi Palani,
I just merged the data tables and then created a new file with the merged data. But it was pretty complicated, because it toke me a while. Here is my logic, but I think I made the process complicated:

  1. Excel Application Scope for the frist data set
    1.1. Read Range with an Output Variable
  2. Excel Application Scope for the second data set
    2.1. Read Range with an Output Variable
  3. Merge Data Table with Source and Destination Output Variable 1.1. and 2.1.
    4. Sort Data Table with input Source from the Merge Data Table
  4. Build Data Table
  5. *For Each Row
    6.1. Get Row
    6.2. Get Row (ends here due the fact that I have only two rows)
    6.3. Add Data Row Data Table and Array Rows
  6. Excel Application Scope
    7.1. Write Range

But I think I made the process with the Sort Data Table complicated, due the fact that I don’t know how to process the Merge Data Table to Build Data Table

1 Like

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