If you’ve ever had a stack of CSV exports and needed them in one place, you know the pain. Opening each file, copying rows, fixing headers, then deleting extra totals gets old fast. This walkthrough shows how to import multiple csv files into one sheet in excel using a simple macro setup you can reuse anytime.
You’ll set up a macro-enabled workbook, confirm your CSV files are ready, add a VBA module, then run a macro that pulls every CSV in a folder into one continuous data stream on a new worksheet.
Prepare your Excel workbook so you can reuse it
Before you import anything, do two quick setup tasks. These steps keep your file reusable, so you don’t have to rebuild the same process every time.

Save the workbook as a macro-enabled “template” file
- Open your Excel workbook (the one you plan to reuse for imports).
- Go to File.
- Select Save As.
- Choose Excel Macro-Enabled Workbook (*.xlsm).
- Add the word template to the end of the file name (for example,
MyImportTemplate.xlsm). - Click Save.
This “template” naming is a reminder. Don’t change this file, just use it, then don’t save changes after you’re done.
Turn on the Developer tab (so you can run macros)

You need the Developer tab to work with macros and Visual Basic.
- Right-click anywhere on the ribbon.
- Select Customize the Ribbon.
- On the right side under Main Tabs, find Developer.
- Check Developer (if it’s not checked).
- Click OK.
After that, you’ll see the Developer tab on the ribbon.
Get your CSV files ready before you import
The macro works best when your CSV files follow two rules. Put every CSV in the same folder, and make sure they all share the same headers.
If you skip this, the import can fail, or you can end up with mismatched columns.
Put all CSV files in the same folder
- Create or choose one folder for the import.
- Move or copy every CSV file you want to combine into that one folder.
- Don’t split them across folders.
The code looks in one place, the folder you point it to, and it grabs everything from there.
Confirm every CSV has the exact same headers

This step matters because the macro expects the same column structure in every file.
- Open each CSV in a plain text editor (Notepad works well).
- Check the first row in each file (the header row).
- Confirm the headers match across all files.
Don’t mix different types of exports. For example, don’t try to import HR data, inventory data, and sales data in one run if the headers differ. This macro setup is meant for one consistent dataset type.
Add the VBA macro to Excel (Visual Basic Editor steps)
Note: The VBA code used in this tutorial is included in the practice file.
Once the workbook and CSVs are ready, you’ll add your Visual Basic code to a module. You can do this once, then keep using the same file.
Open the Visual Basic Editor

Use either method:
- Press Alt + F11, or
- Go to the Developer tab, then click Visual Basic.
Insert a module and paste your code
- In the Visual Basic Editor, click Insert.
- Click Module.
- Paste your Visual Basic code into the module.
The macro name matters. Name it something you’ll understand later, especially if you keep lots of modules.
In this walkthrough, the macro is named:
Import Multiple CSVs to One Sheet
That name appears at the top of your code (the Sub name). It’s what you’ll select when you run the macro from Excel.
(Visual: Screenshot suggestion, Visual Basic Editor with Insert, Module highlighted, and the macro name visible at the top.)
What this macro does when it runs (high-level, plain language)
Based on how it’s set up, the macro does the following:
- It asks you which folder your CSV files are in.
- It imports every CSV from that folder.
- It combines them into one continuous data stream on a new worksheet.
- It keeps the header only once at the top, so you don’t get the header repeated six or seven times.
- It removes total rows that appear at the end of each CSV, so you don’t bring totals in again and again.
- It removes completely blank rows.
- It keeps rows that have partial data (some blanks are fine as long as the row is not fully blank).
- It creates a new sheet for the results (named Combined CSV in this example).
- It shows a message at the end, either:
- an error message if it couldn’t import, or
- a success message that tells you how many rows it imported.
This keeps your final sheet clean: one header, no repeated totals, and no extra blank lines.
Run the macro to import and combine the CSV files

Now you’ll run the macro from Excel, choose the folder, and let it build the combined sheet.
Run the macro from the Developer tab
- Close the Visual Basic Editor (you can click the X).
- Back in Excel, go to the Developer tab.
- Click Macros.
- Select the macro named Import Multiple CSVs to One Sheet.
- Click Run.
Pick the folder that holds your CSV files
After you click Run, a folder picker opens.
- Browse to the folder where you stored the CSV files.
- Double-click the folder (or select it).
- Click OK.
You might not see the CSV files listed in the dialog. That’s normal. The macro is set to grab everything from the folder you selected.
Read the import message and open the Combined CSV sheet

When the macro finishes, Excel shows a message with the result.
In this example, it reports:
“One thousand two hundred rows imported into worksheet Combined CSV.”
- Click OK on the message.
- Find and open the new worksheet named Combined CSV.
At this point, all your CSV files should be merged into one sheet.
Quick checks to confirm the import worked as expected
Do a fast scan so you trust the output before you analyze it.
- Widen your columns so you can read the fields.
- Look at the top of the sheet and confirm the header appears only once.
- Scroll down and spot where one CSV ends and the next begins.
- Confirm totals are not imported.
- Confirm fully blank rows are removed, but partially filled rows remain.
In the example shown, the end of the first CSV file lands on row 201. If there had been a Total row, it would have been on row 202, but it’s stripped out like it should be. A row that has some values still imports, even if a couple cells are blank, because it’s not a fully blank row.
If you scroll to the very bottom, you should also see that totals were not imported there either.
Review the results in Excel before you start analysis

Once everything is in the Combined CSV sheet, you can treat it like any normal dataset.
Confirm formatting and data types look right
After import, take a moment to check the columns that often break during imports.
- Scan any currency columns and confirm values appear with the expected formatting (for example, dollar signs if your code applies that formatting).
- Check a few rows from different points in the sheet (top, middle, bottom).
- Confirm the dataset stays in a single continuous block of rows.
If your goal is pivots, charts, filters, or cleanup work, this is the point where you start.
Know what was removed (so you don’t look for it later)
This import approach is designed to remove repeated clutter so the combined sheet stays usable.
It removes:
- Duplicate header rows from the extra CSV files.
- Total rows that appear at the end of each CSV export.
- Completely blank rows.
It does not remove:
- Rows with partial blanks (as long as at least one cell in the row has data).
That last point is important if your CSVs have occasional missing fields, but still represent valid records.
Save your combined file the right way (so the template stays clean)
After you import, don’t overwrite your macro template. Keep the template ready for the next time.
Save the combined results as a different file
- Go to File.
- Click Save As.
- Choose a new file name for your combined dataset.
- Save the new file.
- Close the file when you’re done, without saving changes back into the template.
The goal is simple: the template stays unchanged, and your combined dataset becomes its own workbook you can edit freely.
Conclusion
This process lets you import multiple CSV files into one sheet in Excel, with one header row, no repeated totals, and no fully blank rows. Once the macro is in place, it only takes a minute to run. Save your results as a separate file, then use the Combined CSV sheet for whatever analysis you need. Keep that macro-enabled template untouched so it’s ready the next time you need to import again.
Get Started with Microsoft 365
Be sure to subscribe to my YouTube Channel for more Microsoft Excel and Microsoft 365 Tutorials.
This page may contain affiliate links. These are tools I personally use and love. I may receive a small commission should you make a purchase using one of these links. This helps keep the tutorials and website posts coming and up to date. Thank you for your support! For more information please see my full disclaimer.