To import multiple CSV files into Excel, the most efficient method is using the Power Query "From Folder" feature. This allows you to point Excel to a specific folder, automatically detect all CSV files within it, and stack them into a single table without having to open or copy-paste each file individually. This process creates a dynamic connection, meaning if you add new CSV files to that folder in the future, you can simply refresh the data in Excel to include the new records.
What You'll Need
- Microsoft Excel (Power Query is built-in for versions 2016 and later; for 2010 or 2013, you may need the Power Query add-in).
- A dedicated folder on your computer or network drive containing only the CSV files you wish to import.
- CSV files that share the same column structure (identical headers and column order) to ensure the data aligns correctly.
Step-by-Step
- Organize Your Files: Create a new folder on your hard drive or a shared network location. Move all the CSV files you want to combine into this folder. Ensure that no other file types (like PDFs or other Excel workbooks) are in this folder, as Excel will attempt to process everything it finds there.
- Initiate the Import: Open a blank Excel workbook. Go to the Data tab on the top ribbon. In the Get & Transform Data group, click on Get Data, then select From File and finally choose From Folder. Note that menu labels may differ slightly depending on your version of Excel or region.
- Select the Folder Path: A browser window will appear. Navigate to the folder you created in Step 1. Select the folder once and click Open.
- Preview the File List: Excel will now display a window listing all the files found in that folder. It shows metadata such as the file name, extension, date created, and folder path. Do not click "Load" yet, as this would only import the list of files, not the actual data inside them. Instead, click the Combine dropdown button and select Combine & Transform Data.
- Configure the File Settings: The "Combine Files" dialog box will open. Excel uses one file (usually the first one in the folder) as a "Sample File" to determine how the others should be read. Check the File Origin (usually UTF-8) and the Delimiter (usually Comma). Ensure the preview window at the bottom looks correct, with data neatly separated into columns. Click OK.
- Refine Data in Power Query Editor: You are now in the Power Query Editor window. Excel has automatically added a column called "Source.Name" which tells you which file each row of data came from. You can keep this for tracking or right-click the column header and select Remove. Here, you can also filter out blank rows, change data types (e.g., changing a column from "General" to "Currency" or "Date"), and remove unnecessary columns.
- Load Data to Excel: Once the data looks exactly how you want it, go to the Home tab within the Power Query Editor and click Close & Load. Excel will now import all the combined data from your CSV files into a formatted table in your worksheet.
Common Mistakes
One of the most frequent errors is including files in the source folder that do not match the structure of the other CSVs. If one file has five columns and another has six, or if the column headers are named differently (e.g., "Date" vs "Transaction_Date"), Power Query may misalign the data or produce errors for those specific rows. Always ensure your CSV exports are consistent before importing.
Another common mistake is forgetting to check the delimiter. While "CSV" stands for Comma Separated Values, some regions or software export "CSVs" using semicolons or tabs. If you see all your data crammed into a single column during the preview stage, it is almost always because the wrong delimiter was selected in the Combine Files dialog.
Users also frequently forget that the "Source.Name" column is added by default. While useful for auditing, if you are performing a VLOOKUP or creating a Pivot Table based on a specific column index, this extra column can shift your data and cause formula errors if you aren't expecting it.
Tips
To make your workflow truly automated, keep your source folder in a permanent location. Whenever you receive a new monthly or weekly CSV report, simply drop that file into the folder. You do not need to repeat the entire import process; just go to the Data tab in Excel and click Refresh All. Power Query will re-scan the folder, find the new file, and append the data to your existing table automatically.
If you have a massive amount of data (hundreds of thousands of rows), instead of clicking "Close & Load," click the arrow under the button and select Close & Load To.... Then, choose Only Create Connection and check the box Add this data to the Data Model. This allows you to analyze the data using a Pivot Table without actually loading millions of cells into the spreadsheet, which prevents Excel from slowing down or crashing.
Use the "Transform Data" stage to clean your data once and for all. For example, if your CSVs always include a few rows of junk text at the top, use the Remove Rows > Remove Top Rows feature. Power Query remembers this step and will apply it to every single file in the folder every time you refresh.
Troubleshooting
If the import fails or you see "Error" in some cells, the first step is to check for "dirty data." Open the problematic CSV file in a text editor (like Notepad) to see if there are stray characters, unexpected line breaks, or symbols that don't match the rest of the dataset. Correct these in the source file and refresh the Excel query.
If Excel cannot find the folder, verify that the folder has not been moved or renamed. If the folder is on a network drive, ensure you have a stable connection and the necessary read permissions. If the path is too long (exceeding 256 characters), try moving the folder closer to the root directory (e.g., C:\CSV_Imports\) and reconnecting the data source.
When the "Combine Files" step fails with a "Column not found" error, it means one of your CSVs has a header name that differs from the Sample File. To fix this, ensure all files have identical headers. If you cannot change the source files, you may need to enter the Power Query Editor, go to the "Transform Sample File" query on the left pane, and rename columns there to standardize them.
Frequently Asked Questions
Can I import CSVs from different folders at once?
The "From Folder" method only works for a single directory. If your files are spread across multiple folders, you can either move them into one folder or create separate queries for each folder and then use the "Append Queries" feature in Power Query to stack them together.
Will this work if my CSVs have different column orders?
Power Query primarily matches data by column position when combining files from a folder. If the columns are in a different order across files, the data will be imported into the wrong columns. You must ensure the column order is identical across all files.
How do I handle CSV files with different delimiters?
Power Query expects a consistent delimiter for the entire folder import. If some files use commas and others use semicolons, the import will fail or be misaligned. You will need to standardize the files to one delimiter before importing.
Does this method work for very large files?
Yes, Power Query is designed to handle much larger datasets than the standard Excel grid. By loading the data to the "Data Model" instead of the worksheet, you can process millions of rows of CSV data efficiently.
Can I filter which files are imported from the folder?
Yes. In the initial preview window (before clicking Combine), you can click the filter arrow on the "Extension" or "Name" columns to exclude certain files, such as temporary files or older versions of the report.