How to Append file excel

If I want combine all file excel in folder in one file.

Please guide me.

@fairymemay

Use Append range activity…

@fairymemay -

  1. Read all the excel files using Directory.Getfiles(Yourpath,.xls*) and call it StrFiles
  2. Using For Each type as string loop StrFiles into EachFile
  3. Inside Read Range > Give ‘EachFile’ and store the output as Dt
  4. If File.exist(“output.xlsx”) ==> when you run this first time file won’t be available
    So under the Else condition add “Read Range Activity” and Give the filename output.xlsx and Datatable as “Dt”
    2nd time when it comes file will be available it will go to Then condition add “Append Range Activity” and Give the filename output.xlsx and Datatable as “Dt”.

@fairymemay - Read range is inside the for each loop…it will read only one file at the time and right output …and then it will read the next file…

@fairymemay - Please find the starter help here…

1 Like

@fairymemay - Please see the read range…i am not using the file name at all…

I am looping the file names in the for each loop

First time==> data1.xls – Each file – this will read and write to using the read range because the output.xlsx file does not exist first time

2nd time ==> data2.xls – Each file – this will read and write to using the append range because the output.xlsx file does not exist first time

Please take some academy courses for “For Each” loop which will help you…or there is lot of youtube videos out there…

@prasath17 From​ picture in​ read​ range you​ use​ sheet1​. But​ I​ want​ read​ first​ sheet.

Got you…Apologize I did not read correctly…
In that case…Use Excel application scope…

This will always fetch the first sheet…In the read range save the output workbook as “WB”

1 Like

There are several videos about them on Youtube. You can have a look if you want.

1 Like

@fairymemay - Did it worked?? let us know, if you need assistance…

@fairymemay - sure … All you have to do is just follow the screenshot closely and mimic step by step. It has only few activities.

File.exists → you should give your final output excel file name here. In my case ouptut.xlsx

Append Range and Read Range → give the same file name

@fairymemay - Fixed now…Your workflow is perfect other than you had duplicated ‘dt’ variable. Run this below file “As is” you will see the output.xlsx gets created in the project folder…

Append Files_Noona.zip (58.0 KB)

2 Likes

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