CSVĀ is the most popular format for storing and exchanging data among users. You might often encounter a situation where you have multiple CSV files from diverse sources and you want to combine CSV files in Excel. The process of merging CSV files into a single file can significantly improve analysis and facilitate easier data access.
In this guide, we’ll explore step-by-step instructions on how to merge multiple CSV files into one file.
Let us look at two methods in detail.
Download the Excel Workbook below to follow along and understand How to Combine CSV files ā download excelĀ workbookSales-Data.zip
Table of Contents
Method 1 – Using Windows Command Prompt
Below are step-by-step instructions on how to combine multiple CSV files using the Windows Command Prompt –
STEP 1: Place all the CSV files in one folder.
STEP 2: Select the folder containing the CSV files and press Ctrl +Shift + C to Copy Path.
STEP 3: In the Windows search box, type the command prompt and select the application.
STEP 4: In the Command Prompt window, type cd followed by a space and then paste the folder path by pressing Ctrl + V.
STEP 5: Use the copy command to combine all CSV files into one. The wildcard * is used to include all files with the CSV extension.
copy *.csv combined-csv-files.csv
The name of the combined csv file will be combined-csv-files.csv. The combined file will look like this –
You can format it as per your requirements.
Method 2 – Using Power Query
Instead of using the Windows command prompt to combine CSV files, you can use the Power Query feature in Excel to easily combine them with just a few clicks. Follow the steps below to know how –
STEP 1: Click on the Data tab and then navigate to the Get Data option.
STEP 2: In the Get Data menu, select From File > From Text/CSV.
STEP 3: Select the file named Desktop Sales and select Open.
STEP 4: Check the sample in the dialog box and click Load.
The data for desktop sales will be loaded in the worksheet.
STEP 5: Repeat the same steps (Steps 1 to 4) to import the sales data for laptops, tablets, and smartphones as well.
Click here to learn how to combine multiple Excel worksheets using Power Query!
Conclusion
This guide explores two methods for achieving this ā Method 1 involves using the Windows Command Prompt, while Method 2 utilizes the Power Query feature in Excel, allowing users to seamlessly combine CSV files with just a few clicks.
The choice between these methods depends on individual preferences and specific data management needs.
Click here to learn all about combined CSV files.
John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.