How to merge multiple CSV files

Posted on October 28th, 2009 by in Coding, Computer, How to

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.

Source

So remember dont waste money on those programs!!! do it yourself! :p

Popularity: 1% [?]

No related posts.

15 Comments

  • At 2009.11.02 15:40, New Jersey Movers said:

    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

    • At 2010.02.05 16:50, Matt said:

      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?

      • At 2010.03.24 03:35, Free Online Games said:

        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.

        • At 2010.06.11 12:02, Paul said:

          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.

          • At 2010.07.14 21:49, snechermxwill said:

            You just saved me so much time, since I was about to start merging all of these manually. this worked really well.

            • At 2010.08.14 05:05, Donace said:

              Glad I could help!

              • At 2010.08.14 05:07, Donace said:

                very cool alternative; will have a look at it. Thanks

                • At 2010.08.16 01:05, life coaching certification said:

                  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!

                  • At 2010.09.08 23:27, Ajith@Make Money Online Free said:

                    I am usually do the copy paste using notepad :)

                    • At 2011.03.14 02:30, Frank Clifton@unlock Iphone said:

                      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.

                      • At 2011.03.14 08:23, Donace said:

                        Hey Frank,

                        putting it as “*VAR.csv InvoicesVAR.csv” etc should work

                      • At 2011.04.08 01:40, Anonymoud said:

                        COOL! Thanks.:)

                        • At 2011.05.16 08:37, Printable coupons said:

                          This is very useful for me. I can merge 8000 CSV with in 2 min.

                          • At 2011.08.30 13:39, Yogi said:

                            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

                            • At 2011.09.13 13:31, Brain said:

                              Thanks billion time, you save my 10hours work I really dont have words to thank you.

                              (A must)
                              (Another Must but dont worry will not be published)

                              Disclaimer

                              All opinions are the authors own and any legal topics should not be relied upon exclusively and own legal counsel should be sought. Affiliate links are used on this site please see our Privacy Policy

                              This Site is Sponsored by Power of Attorney

                              My Everest – Ranking Update

                              My Everest Quest involved getting ranked for Hostgator coupon and Hostgator Promo Code.

                              Ranking 15th Jan Start - Unranked
                              Ranking Q1 #18

                              Copyright © 2007 – 2012 The Nexus All rights reserved