How to Combine CSV Files in Excel with Power Query

How-to basics · Updated November 20, 2026

To combine CSV files in Excel, put the files with matching columns in one folder, then use Data > Get Data > From File > From Folder and choose Combine & Transform Data. Power Query appends the rows into one query, which you can load to a worksheet and refresh when the files change. This works best when every CSV has the same headers and layout.

What You’ll Need

  • Microsoft Excel for Microsoft 365 on Windows, with Power Query available on the Data tab.
  • The CSV files you want to combine, saved in a folder you can access. Keep unrelated files out of that folder or plan to filter them out.
  • A consistent structure: ideally the same column names, delimiter, and header row in every file. The order of columns should also match to reduce import problems.
  • A place to save the Excel workbook. Save it outside the folder of source CSVs so the workbook does not get mixed up with the files you are collecting.

Combining files this way means appending them: the rows from one CSV go below the rows from another. It does not join records side by side based on a matching ID. If you need a side-by-side match, use Power Query’s Merge Queries feature instead.

Step-by-Step

  1. Prepare the source files. Put the CSVs you want to combine in one folder. Open a couple of them first and compare their header rows. For example, if one file has Date, Product, Quantity, make sure the others use the same names and represent the same kinds of values. Remove duplicate copies and unrelated CSVs, or leave them in a different folder. Close the CSVs before importing; Excel can usually read open files, but closing them avoids confusion when you later replace or update a source file.
  2. Start a folder import. Open a blank workbook or the workbook where you want the finished table. On the ribbon, select Data > Get Data > From File > From Folder. Browse to the folder containing the CSV files, select it, and choose Open or OK, depending on the dialog. The folder preview lists the files Power Query can see. Check that the expected CSVs appear before proceeding.
  3. Filter the file list if necessary. In the preview, choose Transform Data if the folder contains files you do not want included. In Power Query Editor, use the filter on the Extension column to keep only .csv. You can also filter the Name column to include only files that follow a naming pattern, or use the Folder Path column if the listing contains files from different locations. Review the list carefully: any file left in this query may contribute rows to the result.
  4. Combine the CSV contents. From the folder preview, choose Combine > Combine & Transform Data. If the preview presents a direct Combine button, use it and select the transform option when offered. Excel opens a sample-file dialog. Check that the sample is one of your intended CSVs and that its preview shows the expected columns. Confirm the delimiter, such as comma or tab, and confirm whether the first row contains headers. Select OK to let Power Query create the combined query and the supporting sample-file queries.
  5. Check the combined preview. Power Query Editor should now show rows from the files together. Confirm that the column headings are correct and that records from more than one file appear. Use the filter arrows to spot blank rows or unexpected values. Check columns that may contain leading zeroes, long identification numbers, dates, or values with commas. Power Query may assign data types automatically; select a column and use the data-type icon in its heading to change it to Text, Date, Whole Number, or another appropriate type. Use Text for codes such as 00427 that must retain their leading zeroes.
  6. Load the result into Excel. In Power Query Editor, choose Home > Close & Load to load the result as a table on a new worksheet. If you want to choose where the result goes, use Home > Close & Load To, select Table, and specify a new or existing worksheet. The combined data is a query result, not a newly created replacement CSV. Save the workbook as an Excel file, such as .xlsx, to retain the query and its refresh settings.
  7. Refresh after changing the source files. When you add another CSV to the folder or replace an existing one, save and close the source file, then return to the workbook. Select a cell in the query result and choose Data > Refresh All. Excel reruns the folder query and updates the table. Keep the folder in the same location if you want the saved query to keep finding it; moving it can break the source path.

The first load may take a little longer if the files are large. The worksheet grid can hold up to 1,048,576 rows, including the header row. If the combined result is too large for a sheet, load it to the Data Model using Close & Load To where available, or split the source into smaller groups.

Common Mistakes

  • Mixing files with different layouts: A file with a missing, renamed, or extra column can produce blank cells or unexpected fields. Standardize the headers before combining, or deliberately transform the columns in Power Query.
  • Including the wrong files: A folder can contain old exports, test data, or unrelated CSVs. Filter by extension and, if needed, by filename. Check the folder listing before combining and verify the output row count afterward.
  • Letting Excel misread codes as numbers: Product IDs, postal codes, and account codes are often identifiers, not quantities. Set those columns to Text before relying on the output; otherwise leading zeroes may disappear.
  • Assuming formatting or formulas will come across: CSV stores plain text values separated by delimiters. It does not preserve worksheet colors, formulas, multiple tabs, or cell formatting from the original workbooks. Apply formatting in the Excel result, and remember that formula results in a CSV are just saved values.
  • Changing the folder path after setup: The query points to a specific location. Moving or renaming that folder can make refresh fail even though the CSVs are still on the computer.

Tips

  • Use a dedicated input folder and a separate output workbook. This makes it easier to see which files are sources and reduces the chance of importing an unintended export.
  • Use a consistent filename pattern, such as Orders_2026-01.csv. A name filter can then help include only the right batch of files.
  • Keep the same header row in each file. If the source exports contain a title or report date above the headers, remove those extra rows in the query or fix the exports before combining.
  • Check the final row count against the individual files. For a quick manual check, add the data rows in each CSV, excluding repeated header rows, and compare that total with the query output.
  • Power Query stores the import steps, so you can adjust them later. Select Data > Queries & Connections, right-click the query, and choose Edit to reopen Power Query Editor.
  • If your files use semicolons or tabs rather than commas, confirm the delimiter in the sample-file dialog. A wrong delimiter can make an entire record appear in one column.

Troubleshooting

The Combine option is missing or unavailable. Confirm that you used Data > Get Data > From File > From Folder, and that the folder contains readable files. Try selecting Transform Data first and checking the file list. If you are using Excel for the web or a Mac edition that does not show the folder connector, use Excel for Microsoft 365 on Windows for this workflow, or import the files individually and append them in Power Query if those options are available in your edition.

Everything appears in one column. The selected delimiter may not match the file. In the sample-file dialog, choose the delimiter used by the CSV, often comma, semicolon, or tab, and inspect the preview before confirming. Regional settings can affect which separator a program uses when exporting a file.

Rows or columns are missing. Reopen the query and inspect the folder list and filters, then check the sample file and the combined preview. A file with a different header row or structure may not fit the sample transformation. Make the source layouts consistent, or edit the query so that each file has the same set of columns before the files are appended.

Dates or numbers look wrong. Check the source text and the column’s data type in Power Query. Dates can be interpreted differently depending on whether the source uses month/day/year or day/month/year. In Power Query, right-click the column and use Change Type > Using Locale to select the correct type and regional format. For IDs or values that must keep their exact characters, use Text instead of a numeric type.

Refresh returns an error. Confirm that the source folder still exists at the saved path, that you have permission to access it, and that the CSVs are not corrupted or locked by another process. Check whether a file was renamed or saved with a different delimiter. To inspect or update the source, open Data > Queries & Connections, edit the query, and review its source and applied steps.

Frequently Asked Questions

Can Excel combine CSV files automatically when I add a new one?
Yes, if you used the folder query. Put the new CSV in the same source folder and select Data > Refresh All. The added file is included as long as it passes any filters and follows the expected structure.

Do all CSV files need exactly the same columns?
They should have the same intended fields and preferably the same headers. Different column order can sometimes be reconciled by header names, but inconsistent or repeated headers can still lead to errors. For reliable results, standardize the columns before combining and inspect the preview.

Will combining the files change or delete the original CSVs?
No. Power Query reads the files and creates a result in your workbook; it does not merge the contents back into the source files. Keep the originals if you need to preserve the source data.

Can I combine CSV files on a Mac?
Power Query capabilities vary by Excel for Mac version, and the From Folder connector may not be available in the same way as on Windows. If you do not see that connector, use Excel for Microsoft 365 on Windows, or import the CSVs separately and append them using the Power Query tools available in your Mac edition.

Can I combine CSV files with different column names?
Yes, but first decide which fields represent the same information. Rename or standardize columns in Power Query before appending, and check whether missing fields should remain blank. If you simply combine inconsistent files, the result may contain separate columns for fields that are actually equivalent.

How do I combine files side by side instead of stacking rows?
The folder-combine workflow appends rows. To place matching records side by side, import the tables into Power Query and use Home > Merge Queries, selecting a shared key column such as an order ID. Check that the key is unique where required so the merge does not multiply records unexpectedly.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.