Many web-based applications and utilities rely upon data that is stored in databases.
This data can then be used to populate reports and display information that is requested by a user of that application.
Some of these applications even allow you to download parameters of data, such as reports or orders that you might require.
These data downloads are typically in the CSV file format, because that file format is very flexible and can be opened in a variety of different programs.
If you have ever downloaded a lot of these CSV files that contained related data, however, then you have likely encountered situations where you needed to be able to view, sort or compare all of the data that was spread across the files.
This specific occurrence is one that will make you want to combine CSV files, which you can accomplish with the help of the command prompt in Windows 7.
Our combine CSV files command line tutorial provides additional information on this topic.
Procedure to Combine CSV Files
The first step in merging all of your separate CSV files into one large file is to copy all of the CSV files to one folder. For the sake of simplicity, I usually create a folder on my Desktop called “CSV,” then I copy the files into that folder. For this example, all of the files have the same four columns – product, price, quantity and date.
The logic behind combining CSV files is that, in order to compare all of this data at the same time, I would need to manually copy and paste all of the information into one spreadsheet. While this is not difficult with a couple of files, it can be extremely tedious when it needs to be done 100 times.
When you have finished combining all of the CSV files, right-click the folder you have created, then click Properties. At the top of the window, to the right of Location, is the location of your folder. Highlight that file location with your mouse, right click the highlighted text, then click Copy.
Click the Start button at the bottom-left corner of your window, type cmd into the search field at the bottom of the window, right-click the search result at the top of the menu, then click Run as administrator. You will then need to click Yes to confirm that you want to allow the program to make changes to your computer.
Click inside the window, type cd, press the space bar, then right-click in the window and click Paste. Note that Ctrl + V does not work inside the command prompt, so you cannot use it to paste your clipboard data. Type the name of your created folder (in this example, again, the name of my folder is CSV). Your command prompt should now display something like this
so press Enter on your keyboard. Type copy *.csv combined-files.csv on the current prompt, then press Enter to combine CSV files. This will generate a new file called combined-files.csv in the same folder in which your individual CSV files are stored. When you double-click this generated CSV file, you will notice that all of the data from your individual CSV files has been combined, allowing you to quickly sort the columns and rows for your data analysis needs.
To further simplify this process, consider using a pivot table to combine similar data. You can read more about pivot tables and what they can accomplish in this article.
Matthew Burleigh has been writing tech tutorials since 2008. His writing has appeared on dozens of different websites and been read over 50 million times.
After receiving his Bachelor’s and Master’s degrees in Computer Science he spent several years working in IT management for small businesses. However, he now works full time writing content online and creating websites.
His main writing topics include iPhones, Microsoft Office, Google Apps, Android, and Photoshop, but he has also written about many other tech topics as well.