Power Query Problems

How to Combine Large CSV Files with Power Query and Power Pivot

Natalie TaylorNatalie Taylor Oct 23, 2026 872 views

Question details

The user needs to combine multiple large CSV files exceeding one million rows and perform data transformations like lookups, error filtering, and duplicate removal.

How to Combine Large CSV Files with Power Query and Power Pivot
Product
Excel
Device & OS
not provided
Scenario
Merging massive datasets from multiple CSV files for data analysis without hitting standard worksheet row limits.
Observed behavior
Worksheet formulas are inadequate and crash or fail for handling over a million rows; the goal is to successfully import, clean, and model this large dataset using background data modeling engines.
Before you start

Ensure all your CSV files are stored in a single, dedicated folder and share the exact same column structure and headers before initiating the import process.

Solution 1Recommended

Combine, Clean, and Load CSV Files Using Power Query and Power Pivot

The most efficient way to handle datasets exceeding Excel's one-million-row limit is by combining them in Power Query, applying necessary transformations, and loading the result directly into the Data Model.

Power Query is specifically designed to handle large-scale data transformation much faster than traditional worksheet formulas. By processing the data in the background and loading it straight to Power Pivot, you bypass physical spreadsheet limitations entirely.

1
Import from folder

Go to the Data tab on the Excel ribbon, click 'Get Data' > 'From File' > 'From Folder'. Browse to the folder containing your CSV files and click 'Open'. On the preview window, click 'Transform Data' to open the Power Query Editor.

2
Combine the CSV files

In the Power Query Editor, locate the Content column and click the 'Combine Files' icon (two downward arrows) in its header. Verify the sample data formatting in the popup and click 'OK' to automatically append all files together.

3
Create calculated columns and lookups

Navigate to the 'Add Column' tab to create any needed custom columns (like text extraction). For lookups, go to the Home tab and click 'Merge Queries' to join your main dataset with your supplementary lookup tables.

4
Filter errors and remove duplicates

To handle #N/A errors, click the filter dropdown on the relevant column and select 'Remove Errors', or isolate them using 'Keep Errors' in a duplicate query. To remove duplicates based on column G, select the column header, right-click, and choose 'Remove Duplicates'.

5
Load to the Excel Data Model

On the Home tab, click the 'Close & Load' dropdown and select 'Close & Load To...'. In the dialog box, select 'Only Create Connection' and check the box labeled 'Add this data to the Data Model'. Click 'OK'.

6
Analyze with Power Pivot

Go to the Insert tab, click 'PivotTable', and select 'From Data Model'. You can now build PivotTables to analyze your massive, multi-million row dataset smoothly.

Combine, Clean, and Load CSV Files Using Power Query and Power Pivot
Bypassing Row Limits: Loading data directly into the Data Model bypasses Excel's physical limit of 1,048,576 rows, allowing you to analyze tens of millions of rows through PivotTables without slowing down your workbook.
Free Microsoft Office alternative

Need a Lightweight Office Suite for Everyday Data Analysis?

While advanced Power Query and Data Model features are specific to Microsoft Excel, WPS Office provides a blazing-fast, lightweight, and completely free alternative for standard data analysis, charting, and daily reporting. If you frequently handle standard spreadsheets and want a seamless, cost-effective solution, WPS Office is an excellent choice.

Fully compatible with Microsoft Excel formats including .xlsx, .csv, and .xls.Lightweight installation with extremely fast startup times for opening large standard CSV files.Familiar ribbon interface requiring zero learning curve.Built-in tabbed workspace for managing multiple spreadsheets easily.
microsoft office alternative - wps office

Frequently Asked Questions

Why use Power Query instead of standard worksheet formulas like VLOOKUP?

Standard worksheet formulas process data very slowly on massive datasets and are strictly limited to Excel's 1,048,576 row limit. Power Query operates in the background, handles millions of rows effortlessly, and automates the cleaning process without bloating your workbook's file size.

How do I separate rows with errors instead of just deleting them?

In the Power Query Editor, duplicate your main query. In the first query, select the column with errors, go to 'Home' > 'Keep Rows' > 'Keep Errors' to isolate them into their own table. In the second query, use 'Remove Rows' > 'Remove Errors' to keep only the clean data.

What is the Excel Data Model and why should I load data into it?

The Excel Data Model is an in-memory database engine (Power Pivot) integrated directly into Excel. It heavily compresses large datasets and allows you to build relational data models and PivotTables on data that far exceeds standard worksheet row limits.

Can I combine CSV files if they have slightly different column names?

When using the automated 'Combine Files' feature, Power Query aligns data strictly based on matching column headers. If the headers differ, you must import the files as separate queries, manually rename the headers so they match exactly, and then use the 'Append Queries' function on the Home tab.