How to merge multiple CSV files into one Excel file with CMD command?
Sometimes, we may need to sort and combine all related CSV files into one Excel file. Using the CMD command, we can achieve the goal in a rather quick and easy way. Different from the complicated built-in Power Query tool in Excel, the CMD command method runs independently of Excel and is easy to operate. In this tutorial, we will introduce the way to merge multiple CSV files into one Excel file with CMD command.
To accomplish the merging of multiple related CSV files, please do as follows.
1. Move all the CSV files that you want to merge into one workbook to one folder.
2. Locate the target folder on File Explore, and go to the Home tab, then click Copy path.
Note: The Copy path button on File Explorer’s Home tab is available on Windows 10 and higher versions. For users of lower versions of Windows, just select the folder, press the Shift key and right-click the folder, then click Copy as path in the menu list.
3. Go to the Windows search box, type cmd, then click the Open button to start the Command Prompt app.
4. In the Command Prompt window, enter the command cd to change the active directory to the CSV folder. Then enter a space, and press Ctrl + V to paste the folder path. Or you can drag and put the folder directly from File Explorer in the Command Prompt window.
5. Press the Enter key to run the command. Then the folder path will appear on the command line, reflecting the active directory change.
6. Continue to type copy *.csv merged-csv-files.csv in the command line. Then press Enter.
The names of all CSV files in the target folder are displayed below the executed command.
7. Go back to the folder which contains the original CSV files. You will see a new file named merged-csv-files.csv.
Open the result file, you will see all data in the original csv files are merged into one Excel File.