If you are looking for ways to merge Excel files into one using CMD, then you are in the right place. Sometimes you may need to combine data from various Excel files into one and to do this quickly you just need to apply some command lines in CMD or Command Prompt. Let’s get started.
How to Merge Excel Files into One Using CMD: 4 Steps
Here, we have the following three files January.xlsx, February.xlsx, and March.xlsx containing the sales records for the January, February, and March months of a company. In the following, we have explained 4 steps to merge or combine multiple workbooks into one workbook using CMD.
We have used the Microsoft Excel 365 version here, you can use any other version according to your convenience.
Step-01: Saving Excel Files as CSV Format in a Folder
The first step for merging multiple Excel files into one is to convert the XLSX files into CSV files.
➤ Go to the File Tab.
➤ Now, select the Save As option and then click on the dropdown symbol beside the Save Option.
Then, you will see different types of file formats in the list, explore them, and choose the option CSV UTF-8 (Comma delimited) from the list of other formats.
➤ In addition to this, change the file name from January to 1-January (the serial numbers preceding the file name will arrange the files serially according to which serial we want to merge them).
➤ Finally, click on the Save option.
Then, we will have our new file name with the new format as 1-January.csv.
Similarly, we will change the file formats for the other two files.
➤ For the February.xlsx file select the option CSV UTF-8 (Comma delimited) from the list of other formats, change the name to 2-February, and click on Save.
After that, you will get the new filename 2-February.csv instead of February.xlsx.
➤ To change the format of the March.xlsx file select the option CSV UTF-8 (Comma delimited) from the list of other formats, change the name to 3-March, and click on Save.
Finally, you will get the new filename 3-March.csv.
Then, we gathered them in a folder named Multiple Files where they are arranged serially. Later we will need the path to go to the folder Multiple Files.
Step-02: Opening CMD or Command Prompt to Merge Excel Files into One
In this step, we will open the CMD or Command Prompt to merge the multiple Excel files into one using this CMD.
➤ Press the WINDOWS key + R and then you will have the Run wizard.
➤ Type cmd in the Open box and then press OK to run the command prompt.
As you can see, we have opened the CMD or Command Prompt.
Step-03: Using Some Commands to Merge Excel Files into One Using CMD
Now, we will type some commands with the command-line interface in this section in the Command Prompt to merge our desired files.
Firstly, we will need to copy the path of the folder Multiple Files in which we have stored our Excel files in CSV format to be merged.
➤ To have the Copy path option, you have to expand the ribbon by clicking on the dropdown symbol in the top right corner or pressing CTRL+F1.
In this way, you will be able to expand the ribbon.
➤ Select the folder Multiple Files and then click on the Copy path option.
Now, get back to the Command Prompt window, and here we will have to change the active directory to go to the path of our folder Multiple Files.
➤ Type cd and provide space after it.
➤ Press CTRL+V or Right-Click on your mouse to paste the copied path of our Multiple Files folder
After pressing ENTER, you will be taken to the directory that we have provided in the previous line.
➤ Now, type copy *.csv combined.csv (where combined is our new filename) followed by ＞in the new line.
After pressing ENTER, the following indicated command lines will be automatically generated where we can see the three file names which we want to merge.
After closing the CMD window, go to the folder Multiple Files where you will have the new merged file named combined.csv.
Step-04: Opening New Created File and Save in XLSX Format
In the previous step, we created a new file combined.csv to merge all three files in the Multiple Files folder. Here, we will change the format of this file from CSV to XLSX.
➤ After opening the combined.csv file we can see the Sales Record of January header first and then the corresponding values of the January file. In this way, the records of the February file and March file are also appearing serially.
➤ To see the remaining values scroll down throughout the sheet.
After that, the remnant values will be visible to us also.
➤ To save the file in XLSX format, go to the File tab.
Then, you will see various options here, and from them click on the Save As option.
➤ From the list of different formats we have selected the Excel Workbook option and then the Save option.
Finally, the name of the merged file is now combined.xlsx.
So, after following the aforementioned steps we have merged 3 Excel files into one with the help of CMD.
In this article, we tried to cover the steps to merge Excel files into one using CMD quickly. Hope you will find it useful. If you have any suggestions or questions, feel free to share them in the comment section.