In the "we work on computers" industry, we're constantly dealing with CSVs—merging, cleaning, analyzing, crying in front of—you name it.
So, to make things a little easier for you, I'll show you how to combine CSVs in seconds.
How Do I Combine Several Files Into One?
Relax! I'm making progress...
Just kidding, I needed to stuff that keyword phrase to get a couple more KWs for SEO.
However, there are a few alternatives:
- CSVs can be merged at the command line (which is what we'll do today).
- A CSV merge tool can be used to merge CSV files.
- CSV to Python merge
- CSVs can be merged by smashing them together with hulking hands (a fictitious method).
I'll show you how to use the terminal to quickly and easily combine and merge multiple CSV files into one CSV file for free on a Mac—but it also works on PCs—in this article (and video) and SOP.
If you encounter any difficulties, we have developed a free tool that you can use.
So go ahead and begin combining!
A message to the lazies
Back in the day I shot a video about how to do this manually on a mac, and it still works. But since then we’ve had a lot of people ask about doing it on a PC.
So we actually just made a tool that combines CSVs for you.
And it’s way faster than the manual method.
And it’s free.
Here’s a link to the tool for all you lazies who don’t wanna read or watch a video: 👉 https://devin.to/csv
–––
If you have multiple CSV or Excel files that you need combined, follow this simple process to get them combined in a flash, using the built in “terminal” on your Mac.
Bookmark this FREE SOP (checklist) that you can run anytime you need to combine more CSVs:
👉 https://devin.to/ps-combine-csvs
Step 1 — Create A New Folder
Create a new folder on your Desktop & put all of your CSV files into the folder.
I will call mine “combine”.
It will look like this:
Caution: Everything in this folder will be combined.
Step 2 — Open Terminal (Aka “The Shell” Or “The Command Line”)
The program “Terminal” is located in your “Applications” folder under “Utilities”
Applications > Utilities > Terminal
Open Terminal.
It will look like this:
Step 3 — Print Working Directory
This is a fancy name. Don’t worry about it, just follow the steps.
- Type:
pwd
- Hit the
return
key
It will look like this:
The abbreviation for "print working directory" is pwd. It displays the "directory" (aka folder) in which you are currently located on your operating system. Don't be concerned. Just keep moving forward.
Step 4 — Select the Folder You Made
Set your "directory" to the folder that contains your CSV files.
type: cd /Users/devin/Desktop/combine
👆 obviously replace “devin” with your name… unless your name is devin.
hit the return key
You must change your file path to match your username and folder name.
Step 5: Merge the Files
Now you are ready to merge your files.
type: cat *.csv >combined.csv
Hit the return key.
It will look like this:
Step 6: Check Your Folder
If you followed along correctly, you are done!
Inside your folder, there will be a file called "combined.csv," which contains all of your csv files combined together.
Note: You might have to delete the duplicate header columns, though.
Just apply a filter to your entire sheet and sort A-Z in column A, and you should see them.
It will look like this:
Last Thoughts
Save this free SOP (checklist) for use whenever you need to combine more CSVs: https://devin.to/ps-combine-csvs
If you found this useful, subscribe to the YouTube channel - where the content is equally as useful, but much funnier because of all the poop jokes.
Cheers and keep it funky, my friends. 🦩
Top comments (0)