Combine CSV Files

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.

copy all of your csv files to one folder

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.

get the folder location of the folder with your csv files

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.

run the command prompt as an administrator

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

use the command prompt to combine csv files

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.

combine csv files into one large csv file

Now that you know how to combine CSV files in Windows, you can use this method to easily merge multiple CSV files into one in just a couple of moments.

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.

Join Our Free Newsletter

Featured guides and deals

You may opt out at any time.
Read our Privacy Policy

Leave a Comment