Header

How to Merge Multiple CSVs into a Single File

Here's an ultra-easy solution to the challenge of merging multiple CSV files into a single file. I'm on a Mac OSX and used Terminal or iTerm

  1. Move all the CSV files into the same folder
  2. Open Terminal or iTerm or your favourite command-line app
  3. cd path-to-the-csv-folder 
  4. cat *.csv > ../result.csv 

This combines all your CSVs into result.csv

In my case, I needed to combine around 140 CSVs and this method took seconds.

The merged file will have multiple records of the headers from each of your CSVs. If you need to clean this up, open result.csv with your favourite text editor and use search and replace.

 

Pas de connexion Internet