Fix Power Query Data Model Column Name Errors in Excel
Question details
The user is experiencing a PivotTable failure originating from a Power Query Data Model because a column name differs from the expected name.
- Product
- Microsoft Excel (Power Query)
- Device & OS
- not provided
- Scenario
- Creating and refreshing a PivotTable from a Power Query Data Model where the source table was duplicated and transformed into multiple queries.
- Observed behavior
- The query and data model fail to refresh, throwing an error indicating that a specific column name cannot be found, often caused by invisible extra spaces in the headers.
Save a backup of your current workbook and ensure you have access to the original source tables to inspect them for minor formatting discrepancies.
Inspect and Remove Trailing Spaces from Column Headers
Identify and remove invisible spaces in your source table or Power Query column headers to perfectly match the expected Data Model names.
When a source table is duplicated and transformed into multiple queries, even a single hidden space at the end of a column name will cause a mismatch. Power Query is strictly case-sensitive and space-sensitive.
Navigate to the Data tab on the Excel ribbon and click 'Get Data', then select 'Launch Power Query Editor'.
In the Queries pane on the left, select the query that is triggering the column name error.
Double-click the header of the affected column. Place your cursor at the end of the text to check for any invisible trailing or leading spaces.
Delete any extra spaces so the column name matches the expected Data Model name exactly, then press Enter to apply the change.
Click 'Close & Load' on the Home tab. Go back to your Excel worksheet, right-click your PivotTable, and select 'Refresh' to update the Data Model.

Try WPS Office for Seamless Data Analysis
If you are tired of encountering complex Data Model and Power Query errors, WPS Office offers a lightweight, highly compatible alternative. Enjoy intuitive data handling, robust PivotTables, and familiar spreadsheet tools without the steep learning curve.
- 1. Download and Install: Get WPS Office for free from the official website and install it on your computer.
- 2. Open Your Workbook: Launch WPS Spreadsheet and open your existing .xlsx file containing the raw data.
- 3. Create a PivotTable Directly: Go to the Insert tab, click PivotTable, and select your data range to start analyzing instantly.

Frequently Asked Questions
Why does my PivotTable say 'column name not found' after refreshing?
This happens when a column name in your source data was altered, deleted, or has an invisible space added. The Power Query Data Model expects the exact original name and fails to load when it cannot find it.
Can I automatically trim spaces from all column headers in Power Query?
Power Query does not have a native one-click button to trim column headers. You must manually rename the headers or use a custom M code formula (like Table.TransformColumnNames) to clean all column names at once.
Do duplicated queries share the same source column names?
Yes, duplicated queries pull from the same initial steps. If you modify a column name in the original source table, you must ensure that all dependent or duplicated queries are updated to reflect the new header name.




