This is a very simple trick I picked up that has saved me A LOT of time when doing research that has required multiple csv files.
Basically what the little snippet does is make all the .csv files in a said folder merge into one nice big .csv file. Making analysis THAT much easier.
The Code for a Batch File
Open up notepad or your equivalent and add the following:
copy *.csv importfile.csv
Then just save the file as a ‘.bat’ and when you need to use it just drag it into the folder and double click, and it will create a file called ‘importfile.csv’ which will be the new merged csv file.
Download
Now some of you might not want to wonder into notepad etc and copy and paste a line!!!! for those of you the download link is below!
Merge Multiple CSV Bat File Download
Nice and simple :p
Alternate Method to merge csv files
Some of you might not trust batch files (its alright I have my doubts on what they do at night as well). So here is a different method with video!!!
1) Choose Start->Run
2) Enter “cmd”
3) Enter the following:copy C:*.csv C:[filname].csv
…replacing the path and filename with your own information.
4) Hit the enter key.
So remember dont waste money on those programs!!! do it yourself! :p
Popularity: 1% [?]
No related posts.
- 15 Comments
- Tags: automation, code, How to, howto, Programming

This is pretty cool, thanks for describing how to do it. I deal with a lot of CSV files and never knew I could merge them so easily. -Jason
Will it work if each of your CSV files has 45000 rows and you have 80 files to merge? Can you open that file if you merge it or will it be to big?
This is nice to be able to merge your csv files into one file, but I have a situation weherby I receive my invoices on a cd-rom that contains 2 types of csv files that need to be split over 2 different merged csv files. On the cd-rom i have invoices that end with the characters VAR and FIX, so basically I need to merge all the files that end with VAR to InvoicesVAR.csv and all files that end with FIX to invoicesFIX.csv. Is there a dos command that can look at the last 3 characters of a csv file? This is an example of how the files look like, for example: Invoice001VAR.csv, Invoice001FIX.csv, etc.Any help is most appreciated.
You can also do intelligent merges of changes made to csv files using ssmerge, see http://coopy.sourceforge.net. It often happens that people have a copy of the same spreadsheet, then make their own changes, and later want to merge those changes into a single spreadsheet. ssmerge is free software for doing that.
You just saved me so much time, since I was about to start merging all of these manually. this worked really well.
Glad I could help!
very cool alternative; will have a look at it. Thanks
it was freaking AWESOME! I tried very hard to find a way to do exactly that, and I totally agree with your enthusiasm. Thank you… According to me simple solution for this is
Solution: copy *.csv target.csv
Simple and neat!
I am usually do the copy paste using notepad
In the cd-rom I have bills that end with the characters and FIX VAR, so basically I need to combine all files ending with VAR InvoicesVAR.csv and all files that end with FIX invoicesFIX.
Hey Frank,
putting it as “*VAR.csv InvoicesVAR.csv” etc should work
COOL! Thanks.:)
This is very useful for me. I can merge 8000 CSV with in 2 min.
thanks buddy… it works great. I went to cmd prompt and went to the directory where my all .csv file are and than ran “copy *.csv main.csv” which worked just perfectly alright
Thanks billion time, you save my 10hours work I really dont have words to thank you.