Compare & combine files · 4 min read

Combine CSV Files in Excel with Power Query: A Folder Workflow

Copying every new export into a growing spreadsheet is easy to repeat incorrectly. A folder import is more useful when you can also explain which files and rows it included.

Start with a folder that means one dataset

Use a new folder containing only the exports that belong in this report. For the example, save the two labeled CSV blocks as january.csv and february.csv. Do not put the combined output in the same input folder. Otherwise a later run could read its own previous result.

Write down the reporting period and whether each export is incremental or a full snapshot. Combining January orders with February orders is different from stacking two complete customer snapshots. If both snapshots contain the same customer, the repeated row may be expected rather than an accidental duplicate.

Input folder: january.csv: 2 orders; february.csv: 1 order. Expected combination: Selected files: 2; Data records: 3; Quantity total: 6. Synthetic totals provide a small reconciliation target before the first load.
Illustrated example. Synthetic totals provide a small reconciliation target before the first load.

Check the schema before opening the folder connector

Open the first few records of each source as text. This example requires the exact headers order_id, sku and quantity. A file with qty instead of quantity requires an explicit mapping; do not assume the two labels are automatically equivalent.

Also check whether exports use the same delimiter and encoding. A semicolon file mixed into a comma export folder can look like a one-column table. Keeping all filenames in one folder does not make their data layouts compatible.

CheckExpected hereIf it differs
Columnsorder_id, sku, quantityMap or separate the schema
Key typesOrder ID and SKU as textPreserve the original identifiers
File scopeDifferent months of ordersReview overlap before stacking
Output locationOutside input folderPrevent reimporting combined output

Related help: Choose append or merge for the result you need

Create the folder import in Excel

The following route follows Microsoft documentation for Excel with the folder connector. Labels and connector availability can differ by edition and platform. If From Folder is absent, check your Excel version instead of replacing the workflow with manual copy-and-paste under the same instructions.

  1. Choose Data > Get Data > From File > From Folder and select the prepared directory.
  2. Choose Transform Data so you can inspect the listed files before combining them.
  3. Filter the file list to the intended CSV exports. Review Folder Path as well as Extension, because subfolders may also appear.
  4. Use the Content column combine command and choose a representative sample file.
  5. Inspect the sample transformation: delimiter, promoted headers and column types. Set identifiers to Text before a numeric conversion changes them.
  6. Retain a filename field such as Source.Name, inspect the combined result, then Close & Load to a new worksheet.

Reconcile the first result before using it

The example should contain A01, A02 and B01 exactly once, with quantities 2, 1 and 3. The total is six. There are three order rows but only two distinct SKUs, so a count of distinct products is not a valid substitute for the order count.

Compare counts by source filename as well as the grand total. Two missing January rows and two unintended rows from another file could leave the total unchanged. A source breakdown makes that mistake easier to see.

Expected source breakdown
january.csv   2 data records   quantity 3
february.csv  1 data record    quantity 3
TOTAL         3 data records  quantity 6
Expected sources: January: 2; February: 1; Total: 3. Wrong selection: January: 0; February: 1; Old backup: 2; Total: 3. Illustrative comparison: the same total does not prove that the correct files were included.
Illustrated example. Illustrative comparison: the same total does not prove that the correct files were included.

Refresh deliberately when the next file arrives

Before adding March, record its data-row count and reporting scope. Place only the intended export in the input folder, refresh the query, and compare the filename breakdown again. The new total should reconcile to the prior selected data plus the new file, unless you deliberately replaced or removed an input.

Keep files with errors visible while investigating. An option that skips them may produce a tidy table missing an entire month. Likewise, do not remove repeated order IDs until you know whether they are duplicate exports, amended orders or multiple line items that need a composite key.

Keep a repeatable handover note

Store the input-folder location, required headings, key definition and expected monthly scope next to the workbook. Include whether quantity can be blank and whether one order can have multiple lines. These short rules are more useful to the next operator than a screenshot of a successful refresh.

The sample arithmetic is verified, while the actual connector steps are documentation-based. Column Harbor cannot access your folder or combine your workbooks. For unusually large files, test resource use on a copy and choose an output destination that can hold the required rows.

Common questions

Will new CSV files be included automatically?

The query can include newly matching files when refreshed, but your filters and folder scope decide what qualifies. Inspect the file list after adding or replacing an export.

What if one file has an extra column?

Decide whether the new field belongs in the shared schema, then inspect and update the sample transformation as needed. Check the result with that specific file; do not assume an extra field survived.

Should I delete duplicate rows after combining?

Only when the business key and duplicate policy are defined. Two equal-looking rows can represent separate events, while a duplicated export can repeat thousands of otherwise valid records.

Sources & method

Examples and diagrams use synthetic data. Application instructions follow the linked documentation; available menus and options can vary. Our sample checks do not establish behavior in every Excel or Google Sheets version. Read our AI-assisted editorial method.

Browse all field guides →