All Collections
Bulk Data Downloads
Combining Multiple CSV Files
Combining Multiple CSV Files

How to combine multiple CSV files using the MacOS Command Terminal

Julien Stamatakis avatar
Written by Julien Stamatakis
Updated over a week ago

Downloading bulk data via FTP can provide you CSV files, organized by dashboard, Node ID, data channel, and month.

This is a trick that can save you time when working with a dataset spread across multiple CSV files. 

Step 1

Download and save the CSV files that you want to combine into a single folder.
*Make sure that the folder is free from any files that you do not want to include in the compression.

Step 2

Open Terminal. Check your working directory.

#type in "pwd" and hit enter

Step 3

If the current working directory is not the folder where your folder with the CSV files are located, change the working directory to point it towards your folder as follows:

#type in "cd" _space_ your directory path
cd /Users/Stephanie/Desktop/filesToMerge

Tip: If you navigate to your desired folder, you can see the folder location path by right clicking, and selecting 'Get Info'.

Step 4

Type the following command in Terminal to create a new file with merged data.

#type "cat" _space_ "*.csv" _space_ ">nameofnewfile.csv" 
cat *.csv >merged_channelName.csv

Now your combined CSV file is the newly created file called "merged_channelName.csv"
Note: You can change the "merged_channelName" file name to any of your choosing. 

Step 5

Verify the file in your folder. 

Did this answer your question?