I have 100 excel documents with the same data structure and property fields, I want to merge all the excel documents into one excel document, how can I do it?

Has anyone done a scene like this, please? :grinning:

Consolidation can be done using VBA

There’s an alternative way too.

https://www.codeproject.com/Tips/5264786/Merge-Many-Excel-Files-into-one-VBS

Thank you,bro. But ,I’m not familiar with VBA,how do I put these VBA code into the UiPath Activity? :pray: :pray: :joy: Could you please show me how to do it?

Hi

First Loop to all your Excel Sheets and then Inside Loop read each excel sheet data and store it in a DataTable (datatable1)

Write an If Condition that your Maindt.Rows.Count>0 then Use Merge Data Table activity and Pass Source as datatable1 and Destination as Maindt. else Store datatable1 all the data inside Maindt by using Assign Activity (Maindt=datatable1)

@491979546

Hi

Please refer this thread for a xaml

And if you are looking for a component

Cheers @491979546

Thank you,Bro. Do you have more detailed instructions on how to do this? :grinning: Actually , every excel file have only one sheet. I know how to loop the files , but don’t know how to merge each DataTable from each excel file… :joy: :joy:

Hi

Please find the attached screenshot of the solution
Here first we have a loop to our Excel Doc and then read one by one each excel first sheet data and on the basis of Condition we have merged our data in the main data table

Happy Automation

:disappointed_relieved: it is too hard for me . Can you show me a Demo. :pray: :pray:

Hi
Please find the below working Demo
TestExcel_Demo.zip (14.6 KB)

Cheers
@491979546

Thank you so so much怂怂
Your demo can achieve the effect I want, but I follow your demo and it says maindt is empty and reports an error. :sob:

1 Like

Hi @491979546

Please use the Updated one I have attached after a few modifications and make sure you have initialized the maindt with New DataTable() in variable panel , if you are still facing the issued share the error screenshot

Thanks


Bro,please help me with it怂 :joy: :pray: :pray:

Hi @491979546

This error has occurred because you haven’t initialized the mainDT variable with New DataTable as Default.

See the below-attached screenshot

Cheers

Great, thank you so much, I’m a newbie :joy:, so I aways make mistakes…is new DataTableļ¼ˆļ¼‰a method which means create a empty DT?

Hi @491979546

No Issue we are happy to help :slight_smile:

Exactly it means that you are initializing the DataTable with Empty DataTable before going to use it.

Thanks

Thank you ,you are great UiPath master! :grinning:

1 Like

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