Merge multiple excel files

Hi, I would like a sample of how to merge 3 excel files. I have attached the 3 files, Thanks.file1.xlsx (9.3 KB)
file2.xlsx (9.3 KB)
file3.xlsx (9.3 KB)

Hi,

You can read all excel files and output datatables. Then use the merge datatable activity.

Thanks @Emman_Pelayo. Kindly provide me a sample for me to learn the codes. Appreciate your help when it’s convenient to you. Many thanks.

Hi @Kindergarden

I have provided some sample workflows in a similar post. You van check it out too…

How can we use merge data table activity? - #4 by Lahiru.Fernando

If this works for you, please mark the answer as the solution to help others as well :slight_smile:

2 Likes

Hi @Kindergarden

Designed code according to your requirement.

It contains two folders Inputfiles with your 3 input excel files and in outputfiles folder one folder which will provide consolidated data into a excel file. Please find attached code.

BlankProcess.zip (39.4 KB)

This should work for you.

Regards,
Vijay Kumar C.

You can check on this:

MergeExcel.zip (30.2 KB)

Thanks @Emman_Pelayo. I could see the output messgae. I tried adding excel application scope and write range to output into excel but encountered errors. Can provide me the sample wth output file too as I am new to all this. Thanks a lot!

Thanks @Vijay_Kumar_C. I will try to understand your codes and follow up with some queries later as it’s quite advanced to me so that I could learn the technicques you employed.

Hi @Emman_Pelayo,

I realised if file2 has a dofferent column header, then the putput with be more than one column. Actually, the 3 files have one column but the column label may be different.

Please advise how I could merge the 3 files into ONE column regardless of rhe column label. Can please help with a revsied sample. I am lost. file2.xlsx (9.3 KB)
Thanks! Main.xaml (6.9 KB)
testoutput.xlsx (7.2 KB)

Hi Kinder,

Merge datatable will not be applicable if that is the case. You may check on the updated workflow:

MergeExcel_v2.zip (35.7 KB)

I recommend you take the Basic foundation Training of UiPath on their academy platform. It is free BTW. :slight_smile:

1 Like

Thanks @Emman_Pelayo for clarifying, Yes, what i wanted is to combine all the excels into one file.

I suppose if it’s one column in all files but different column labels, then merge will be appropriate so that all the columns are combined into one file.

Sorry everyone for using the wrong term.

1 Like

Hey @Kindergarden

Let me know where you stuck with my code. Because i generalized it to work in any system.

Regards,
Vijay Kumar C.

1 Like

Thanks @Vijay_Kumar_C for people like all of you in the ciommunity. This is an effective way to learn by having experts guide newbies like me. I will go thru the codes and ask those parts that I do not understand. Pretty complex to me.

1 Like

Thanks @Lahiru.Fernando. I will check out your post too and run the program later. They will be helpful should I want to merge tables with multiple columns. Cheers !

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