Power Query Problems

How to Merge Multiple Datasets into One Excel Pivot Table

Camila MilosovichCamila Milosovich Oct 19, 2026 869 views

Question details

The user needs to combine data from multiple worksheets or CSV sources into a single Pivot Table but encounters an error when trying to chain sheet references.

How to Merge Multiple Datasets into One Excel Pivot Table
Product
Excel
Device & OS
not provided
Scenario
Attempting to create a consolidated PivotTable from multiple separate reports, datasets, or CSV files that may have different headers or data types.
Observed behavior
Excel displays a 'Reference isn't valid' alert when attempting to use chained sheet references (e.g., Sheet1!Sheet2!Sheet3!Sheet4!) as the PivotTable data source.
Before you start

Ensure all your source datasets are formatted as Excel Tables (press Ctrl+T) or are saved in an accessible folder if using CSV files. Take note of the column headers in each dataset, as they need to align correctly for a seamless merge.

Solution 1Recommended

Use Power Query to Append and Merge Datasets

Power Query allows you to import multiple tables, standardize their formats, and append them into a single dataset suitable for a combined PivotTable.

Chaining references (e.g., Sheet1!Sheet2!) is not a valid syntax in Excel for creating PivotTables. Excel requires a single, unified data range or a consolidated data model to generate the report.

Instead of manual copy-pasting, Power Query provides a robust way to stack tables vertically, even if they originate from different CSV files or worksheets. Before appending, it is crucial to ensure that all matching fields across different reports use consistent names and data types.

1
Import data to Power Query

Navigate to the Data tab on the Excel ribbon, click 'Get Data', and select your data source (choose 'From Table/Range' for existing sheets, or 'From File' for CSVs).

2
Standardize column names and types

In the Power Query Editor, double-click headers to rename them so that equivalent columns have the exact same name across all queries. Ensure data types (Text, Number, Date) match perfectly using the data type icon next to the header.

3
Append queries

On the Home tab of the Power Query Editor, click 'Append Queries' or 'Append Queries as New'. Select the two or more tables you wish to stack vertically and click OK.

4
Load data and create PivotTable

Click 'Close & Load To...' on the Home tab. In the import dialog, choose 'PivotTable Report' (or load it to the Data Model first), and click OK to generate your combined PivotTable.

Use Power Query to Append and Merge Datasets
Tip for CSV Files: The actual file name of the imported CSV does not disrupt the process, provided the internal column headers are mapped and named correctly before appending the queries.
Free Microsoft Office alternative

Need a Lightweight, Highly Compatible Spreadsheet Tool?

If you are dealing with complex data connections, frequent crashes, or simply need an intuitive, fast, and free spreadsheet application, WPS Office is an excellent alternative. It offers extensive Pivot Table functionalities and seamless compatibility with Microsoft Excel formats.

  1. 1. Download and Install: Download WPS Office for free from the official website and complete the quick installation.
  2. 2. Open Your Workbooks: Launch WPS Spreadsheet and easily open your existing Excel workbooks (.xlsx) or CSV files.
  3. 3. Analyze Data: Use the built-in PivotTable and multi-sheet consolidation tools to seamlessly analyze your datasets.
100% compatible with Microsoft Excel (.xlsx, .xls, .csv) formats.Lightweight software that opens large datasets and CSV files quickly without lagging.Familiar user interface with powerful PivotTable, Data Consolidation, and analysis tools.Free to download and use for all your essential spreadsheet tasks across multiple platforms.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get the 'Reference isn't valid' error when making a Pivot Table?

This error occurs when you try to chain multiple worksheet references (like Sheet1!Sheet2!) in the data source range input box. Excel requires a single contiguous data range, a named range, or a consolidated data model to create a PivotTable.

Do the headers need to match exactly when appending datasets in Power Query?

Yes. When using Power Query to append tables, columns with the exact same header name and data type will be stacked in the same column seamlessly. If headers differ even slightly in spelling or spacing, Power Query will create separate, disjointed columns for them.

Can I combine data from different CSV files into one Pivot Table?

Absolutely. You can use the 'Get Data from Folder' feature in Excel to import a batch of CSV files into Power Query at once, automatically append them, and then load the combined dataset directly into a single Pivot Table.