How to Fix Power Query Rows Changing Order After Loading to Excel
Question details
Users experience data rows changing their order unexpectedly after loading from Power Query into an Excel worksheet, despite the rows appearing perfectly ordered in the Power Query Editor.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Loading transformed query data from the Power Query Editor back into a standard Excel worksheet table.
- Observed behavior
- The row sequence in the final Excel table does not match the expected sequence displayed during the last step of the Power Query Editor.
Verify whether the output destination table in Excel has any pre-existing sort settings applied directly on the worksheet, as these worksheet-level filters can automatically override the incoming Power Query data order.
Apply an Explicit Sort Step in Power Query
Force Power Query to lock in your desired row order by adding a specific sort operation at the very end of your query.
Power Query's engine optimizes data processing for speed and performance. Because of this, it does not inherently guarantee the final row order upon exporting unless you explicitly instruct it to sort the data right before loading.
Navigate to the 'Data' tab on the Excel ribbon, click on 'Queries & Connections', and double-click your query to open the Power Query Editor.
Select the column you want to define the order by. Click the drop-down arrow on the column header and choose 'Sort Ascending' or 'Sort Descending'.
Check the 'Applied Steps' pane on the right side of the editor to ensure 'Sorted Rows' is the absolute final step in your query list.
Click 'Close & Load' in the top-left corner to push the newly sorted data back into your Excel worksheet.

Add an Index Column to Preserve Source Order
If your data relies entirely on the source file's original unsorted order, adding an Index column ensures the exact sequence is preserved.
Adjust the Excel Table Load Destination
Change the loading destination cell to reset any conflicting worksheet formats or hidden sort metadata.
Try WPS Office for Fast and Reliable Data Management
If you are tired of complex query errors and heavy processing engines scrambling your data, WPS Office provides a lightweight, highly compatible, and free alternative. Enjoy seamless spreadsheet formatting and data organization without the hassle of unpredictable background optimization.
- 1. Download and Install: Get WPS Office for free from the official website and follow the quick installation prompts.
- 2. Open Your Workbook: Launch WPS Spreadsheet and easily open your existing .xlsx or .csv data files.
- 3. Manage Data Securely: Use the highly stable built-in Data tab to apply direct filtering and sorting to your tables.

Frequently Asked Questions
Why does my data look perfectly sorted in Power Query Editor but not in Excel?
Power Query is designed to load data as quickly as possible and does not inherently guarantee row order during export. The preview in the editor reflects your step-by-step logic, but the final output requires an explicit 'Sort' step at the end of the query to lock the sequence.
Can existing Excel table filters affect Power Query output?
Yes. If the destination table in your Excel worksheet has active sort settings or filters applied previously, those settings will automatically reapply upon refreshing and override the incoming Power Query data order.
How do I remove an accidental sort on my Excel output table?
Select any cell in the loaded Excel table, navigate to the 'Data' tab on the main ribbon, and click 'Clear' in the Sort & Filter group. This will strip away any worksheet-level sorting that is interfering with your query.
Does adding an index column slow down Power Query?
Adding an index column is generally very fast. However, it can slightly impact performance on extremely large datasets because the engine must process the rows sequentially to assign numbers, limiting its ability to run operations in parallel.




