Append Excel data into a new Excel file

I have a requirement where we get 5 excel files into a shared drive. Each excel has like 14000 records in it, All we have to do is get all the data from all 5 files and append/paste the data into new excel file (Template). I was able to do this task using MS Excel VBO with less records like 4000 records in each file and if it exceeds 4000, I see the error message as - "System.OutOfMemoryException". Did anyone of you faced this before, Please suggest if you know anything related to this.

Getting all those records from each file putting in one collection, in total crosses 40000 records & then "System out-of-memory" error pops-up.

So, in order to avoid this type of situation, Get the data from each file and immediately write the data to template(excel) & repeat this for all the remaining excel files.

This way we can achieve it.

Keep me posted, how it goes.