How to combine multiple CSV files?

Many a times you will need to combine multiple csv files in to one. Combining is required when you receive multiple files (for ex- different file for each date), but you need to process them in Excel or any other tool as a single file.

There are 3 methods to do merge csv files

  1. Manual – off course, was it even necessary to mention :). Though this option is not available if no. of rows in your csv files exceed maximum no. of rows in excel.
  2. Use software available in market (For example – Delimitware). This is a nice piece of software and lets you do a lot of things with large csv files.
  3. Use windows command prompt. This method is discussed in detailed in the rest of the article.

Use Windows Command prompt to merge CSV files

This is a neat trick and comes very handy for merging large CSV files. Let’s get down to the process then:

  1. Keep all the files you want to merge in a different folder.
  2. Open command prompt.
  3. Change directory to the folder containing your files.
    (Command: cd ‘directory path’)
  4. Now copy using COPY command.
    (Command: copy *.csv combined.csv)

    • This command is using wild card (*) to find all files in a particular format (CSV). You can also use .txt to find and combine text files.
    • combined.csv is the name of combined file and it will be available in the same folder where you kept your original csv files.
  5. What if you want to copy files with a common name appearing in your file names? You can again use wildcard to find files with the common name and copy.
    (Command: copy *common name*.csv combined.csv)

    • This will find all the files with the ‘common name’ and copy those specific files to combined.csv


Add Comment