Unable to Merge different excel files into one

Hello All,

I am downloading several reports from a platform and saving them into a specific folder, what I need to do now is to create 1 File that contains all the information included in the several files I downloaded.

Thanks in advance for the help
Chinchi-Bot

@david.chinchilla-alvarez

Try below mentioned steps.

  1. First read all files from that folder as below.

     arrFiles [] = Directory.GetFiles("Folder Path","*.xlsx")
    
  2. And then use For Each loop activity to iterate one by one file inside the folder.

  • Use Workbook Read Range activity to read the data from the file and it will give output as DataTable.
  • And then use workbook Append Range activity and pass above output DataTable to append all the data.
1 Like

Hi @david.chinchilla-alvarez ,

The question is if all the excel files have the same columns ? If not, it will require somehow normalise the data before merging.
If you are able to share the files with us it would be great.

If the columns are completely different we can use write range and write the data next to each set of columns :wink:

Regards,
Kamil

1 Like

Hi Ganta,
Thanks for replying.
Sorry but I did not understand the instructions, how do I read the files? could you please share an screen shot of the path you are reffering? thanks in advance.

Hi Kamil,
Thanks for replying.
Hey Kamil all the columns are the same, what varies are the accounts and information but columns and headers are the same.
Thanks in advance for your comments.
David

@david.chinchilla-alvarez

Use Workbook Read Range activity to read the Excel file.

Hi,

Have you tried Merge Datatable?
Is it possible to send me the two sample files so I can test the solution and send it back to you?
My first choice would be ReadRange Workbook to read the files to Datatable → try to use Merge Datatables :wink:

Regards,
Kamil

Hi @david.chinchilla-alvarez

Please take a look at the screenshot below with one of the possible solution:

I am adding also a xaml file so you can check each stage.

MergeExcelFiles.xaml (8.5 KB)

Let me know if that works for you, if so mark as solution and like :wink:

Regards,
Kamil

Hi Kamil,

is that for studio X? I am not getting those options in STudiox or maybe am I missing a special package to download?
Also when I open the xaml file I am getting the following error:

Thanks in advance for your comments.
David

@david.chinchilla-alvarez

I am using UiPath Studio not StudioX.
So, I understand that you are using StudioX right?

I made quick solution in StudioX. Please take a look and play with it.

I have attached the solution developed in StudioX.

MergeExcelFiles.zip (168.0 KB)

Regards,
Kamil

@david.chinchilla-alvarez

Have you had a chance to check my solution?

Regards