How to Merge Excel Files into One Using CMD (with Simple Steps)

If you’re working with multiple Excel-compatible .csv files and want to combine them quickly, the Windows Command Prompt offers a fast and easy solution. Instead of opening each file in Excel and manually copying data, you can use a simple CMD command to merge all your files in just a few seconds.

In this article, you’ll learn exactly how to merge Excel files into one using CMD, with detailed, step-by-step instructions for every part of the process.

Key Takeaways

To merge Excel files using CMD:
➤ Move all the CSV files into one folder.
➤ Open Command Prompt and go to that folder.
➤ Run a copy command to combine them.
➤ Open the merged file in Excel to verify.

overview image

Download Practice Workbook

Detailed Steps to Merge Excel Files Using CMD

Using the Command Prompt is one of the fastest ways to merge multiple .csv files without opening Excel at all. It’s especially useful for combining large batches of reports or structured data exports. Let’s get started.

Step 1: Convert Excel (.xlsx) Files to CSV Format

Before merging with CMD, your Excel .xlsx files need to be saved as .csv because CMD’s copy command works only with plain text files like CSV. Skip this step if you are already working with .csv files.

Steps:

➤ Open your .xlsx file in Microsoft Excel. For example, open Report2023.

Merge Excel Files Using CMD

➤ Click on the File tab in the top-left corner.

Merge Excel Files Using CMD

➤ Select Save As (or Save a Copy in some versions).
➤ Choose a folder to save your file, preferably the same folder where you will merge files such as Downloads.
➤ In the Save as type dropdown menu, select CSV (Comma delimited) (*.csv).
➤ Enter a name for your CSV file if you wish (e.g., Report2023.csv) or you can leave it as it is and click Save.

Merge Excel Files Using CMD

➤ Excel may show a warning about features not supported in CSV, click OK or Yes to continue.

Merge Excel Files Using CMD

➤ Repeat these steps for each .xlsx file you want to merge (Report2024.xlsx, Report2025.xlsx, etc.).

Merge Excel Files Using CMD

Now you have CSV versions of your Excel files ready to be merged using the Command Prompt method in the next steps.

Step 2: Place All Your CSV Files in a Single Folder

Before running any command, it’s important to collect all the files you want to merge and keep them in one place. This makes it easier to reference them from CMD.

Steps:

➤ Press  Windows  +  E  to open File Explorer.
➤ Navigate to a location where you have write permissions, like Downloads.
➤  At the top-left corner, hover over the New option and select Folder from the submenu.

Merge Excel Files Using CMD

➤ When a new folder appears, rename it to something like MergedCSVs.
➤ Press Enter to confirm the folder name.

Merge Excel Files Using CMD

➤ Open a separate File Explorer window (or a new tab) and go to the location where your .csv files are saved (e.g., Downloads or Desktop).
➤ Click on the first .csv file, then hold down  Ctrl  and click the others to multi-select them.
➤ Right-click on any selected file and choose Cut or use  Ctrl  +  X  .

Merge Excel Files Using CMD

➤ Return to the MergedCSVs folder, right-click inside, and select Paste or use  Ctrl  +  V  .

Merge Excel Files Using CMD

➤ Now all your files like Report2023, Report2024, and Report2025 are ready for merging in the same folder.

Merge Excel Files Using CMD

Step 3: Merge Files Using Windows Command Prompt

Now you’ll open the Command Prompt, a text-based interface where you can run commands like file copy operations. We’ll use the cd command (short for “Change Directory“) and copy command which tells CMD which folder to work inside and merge the contents of all CSV files into a single file called Merged.

Steps:

➤ Press Windows Key and type cmd in the search bar.
➤ Click Command Prompt from the results to open it.

➤ Right-click and select Run as administrator.

Merge Excel Files Using CMD

➤ You’ll see a black window open, showing your current user directory like this:

C:\Users\YourName>

➤ In the Command Prompt window, type your file location starting with cd and wrapped in double quotation like this:

cd “C:\Users\97158\Downloads\MergedCSVs”

➤ Replace the folder path with the exact location of your folder. Include quotes if the folder name contains spaces.
➤ To extract your file location easily, right click your Merged folder and select Copy as path which you will paste inside Command Prompt.

Merge Excel Files Using CMD

➤ Press Enter. You should now see:

C:\Users\97158\Downloads\MergedCSVs>

This confirms that you’re now inside the correct folder where all the CSV files are located.

➤ To merge the files in CMD, type this command:

copy *.csv merged.csv

➤ Press Enter.

Merge Excel Files Using CMD

Here *.csv tells CMD to include every file ending in .csv and merged.csv is the name of the new file that will be created.

➤ If merged.csv already exists in that folder, CMD will ask whether you want to overwrite it.
➤ Once completed, you’ll see a confirmation with your file names and 1 file(s) copied.

This means your merged file has been created successfully.

Step 4: Open the Merged File in Excel and Convert Back into .XLSX Format

Now that your file has been created, you can open it with Excel to check that everything is combined correctly and save it to your original file format easily.

Steps:

➤ Open File Explorer and go to the same folder.
➤ Double-click the new merged.csv file.

Merge Excel Files Using CMD

➤ Excel will automatically launch and open the file. You’ll find all the rows from each CSV file stacked on top of each other.
➤ If each file had a header row (like “Name, Sales, Year”), you might see the same header repeated before each data block, you can scroll down the file and delete extra headers manually if needed.

Merge Excel Files Using CMD

➤ To Convert back to .xlxs file format, go to file tab >> Save As >> Pick your location >> Select Excel Workbook under the Save as type drop-down >> Click Save.

Merge Excel Files Using CMD

Now you will find your merged Excel file in your chosen location.


Frequently Asked Questions

Can I merge .xlsx Excel files using this method?

No. CMD cannot process .xlsx files. This method only works for text-based formats like .csv or .txt. You can easily do the conversion or use alternate methods like Power Query or VBA for .xlsx files.

Will this keep formatting like colors or bold text from Excel?

No. CSV files store only plain text, no fonts, formulas, or formatting. The merged file will include raw values only. So, you need to do the formatting manually afterwards.

What if one of my CSV files is empty or missing headers?

CMD will still merge the file, but if it’s empty, it won’t affect the output. If headers are missing, the data will appear immediately with no column titles.


Wrapping Up

In this tutorial, we learned how to merge Excel files into one using CMD by combining .csv files with the built-in copy command. This method is incredibly simple, fast, and doesn’t require opening Excel at all. By organizing your files into one folder and running a single command, you can merge large batches of data in seconds which is ideal for logs, exports, and repeated reporting tasks. Feel free to download the practice file and share your feedback.

ExcelInsider Team
We will be happy to hear your thoughts

Leave a reply

Excel Insider
Logo