Excel Power Query After .xls to .xlsx Migration: Fixing Broken Queries

March 13, 2026 · 9 min read

You converted your legacy Excel files from .xls to .xlsx. The workbook opens. The formulas work. Then you refresh your Power Query and get a wall of red errors. DataSource.Error: File not found. Expression.Error: The column 'Order ID' of the table wasn't found. DataFormat.Error: We couldn't convert to Number.

This is the part most migration guides skip: Power Query stores your data sources and transformation logic in M code, and that M code references the exact file path, file extension, sheet names, and data types of your original files. When the file format changes from .xls to .xlsx, Power Query treats it as a different source — and every assumption baked into your queries may need revisiting.

This guide covers the three most common categories of Power Query breakage after migration and how to fix each one.

Why Power Query Breaks After Format Migration

Power Query is a transformation engine. It records every step you take as M code in the Applied Steps pane. When you originally built a query against sales-data.xls, the Source step in your M code looks like this:

= Excel.Workbook(File.Contents("C:\Reports\sales-data.xls"), null, true)

After migration, that file is now sales-data.xlsx. Power Query looks for sales-data.xls, finds nothing, and the entire query chain fails. It doesn't matter that the content is identical — to Power Query, it's a different file.

That's the straightforward case. The more subtle problems come from three other sources: data type inference differences between formats, sheet and named range references, and M function behavior that varies between legacy Jet-backed .xls and Open XML-backed .xlsx.

Problem 1: Broken Data Source Paths

Symptom

DataSource.Error: Could not find file '...\filename.xls'

Fix: Update the Source Step

  1. Go to Data → Get Data → Launch Power Query Editor
  2. Select the affected query in the left panel
  3. In the Applied Steps pane (right side), click the Source step
  4. In the formula bar, update the file path from .xls to .xlsx
  5. Click the checkmark or press Enter to apply

If the query uses the Advanced Editor (right-click the query → Advanced Editor), find the File.Contents line and update the extension there.

Better: Use a File Path Parameter

If you have multiple queries pulling from the same source file — or if this file path will change again in the future — use a parameter instead of hardcoding the path:

  1. In Power Query Editor, go to Home → Manage Parameters → New Parameter
  2. Name it SourceFilePath, set Type to Text, set the Current Value to your .xlsx file path
  3. In each affected query's Source step, replace the hardcoded path with the parameter:
    = Excel.Workbook(File.Contents(SourceFilePath), null, true)

Now when the source file moves or changes format, you update one parameter instead of hunting through every query.

Still working with .xls files?

LegacyLeaps converts legacy Excel files to .xlsx while preserving all your formulas, VBA macros, and named ranges. Scan free to see exactly what's in your files before you migrate.

Run the Free Scan

Problem 2: Data Type Errors After Migration

The .xls format uses the legacy Jet engine for data type inference. The .xlsx format uses Open XML, which stores cell types explicitly. This means the same data can be interpreted differently after migration — and Power Query's Changed Type steps can start throwing errors.

Common Type Mismatch Scenarios

What you had in .xls What .xlsx may return Power Query error
Numbers stored as text (leading zeros, phone numbers) Numeric values (leading zeros stripped) DataFormat.Error in Changed Type step
Dates stored as text ("2024-01-15") Date serial numbers or actual Date values Type mismatch in date comparison steps
Blank cells treated as null Empty string "" in some columns Errors in filter/replace steps expecting null
Mixed numeric/text in a column Column inferred as Text or Number based on majority Conversion errors in downstream steps

Fix: Audit and Explicitly Set Types

After updating your Source step to point to the .xlsx file, step through each Applied Step and watch the data preview for type indicator icons (the ABC/123 icons in column headers). Any column that changes its type indicator needs attention.

The safest fix is to add an explicit Changed Type step immediately after the Source and Navigation steps — before any filtering or transformation — using Table.TransformColumnTypes:

= Table.TransformColumnTypes(#"Previous Step", {
    {"Order ID", type text},
    {"Amount", type number},
    {"Date", type date},
    {"Customer Code", type text}
})

Explicit typing removes the ambiguity of format-dependent inference. It also makes your queries more resilient to future format changes.

Special Case: Leading-Zero Columns

ZIP codes, employee IDs, part numbers, and phone numbers stored in .xls as text with leading zeros may come through as numbers in .xlsx. Fix this by setting the column type to type text before any transformation, and add a padding step if needed:

= Table.TransformColumns(#"Changed Type", {
    {"ZIP Code", each Text.PadStart(Text.From(_), 5, "0"), type text}
})

Problem 3: Sheet and Named Range References

Sheet Name Changes

If you renamed any sheets during the .xls to .xlsx conversion — even to fix a typo — Power Query's Navigation step will fail. The Navigation step references sheets by name:

= Source{[Item="Sheet1",Kind="Sheet"]}[Data]

If the sheet is now called Data instead of Sheet1, update this step to match. You can also navigate by index (Source{0}[Data]) if your sheet is always first, though name-based navigation is more maintainable.

Named Tables vs. Sheet Ranges

If your .xls file had defined named ranges and your queries used Excel.CurrentWorkbook() to load them, check that the named ranges survived the migration intact. Open the .xlsx file, go to Formulas → Name Manager, and verify your range names are still present with the correct scope.

Watch out: Named ranges that referenced external workbooks in .xls sometimes lose their definitions during format conversion. If you see #REF! errors in the Name Manager after migration, the named range needs to be recreated before your Power Query will work.

Hidden Sheets

Some .xls files use hidden sheets as data staging areas. Power Query may reference these sheets by name. After migration, verify that hidden sheets transferred to the .xlsx file. In Excel, right-click any sheet tab and select Unhide to see all hidden sheets.

Problem 4: Queries That Pull from Multiple .xls Files

If you used Get Data → From Folder to load all .xls files from a directory, your query is likely filtering by file extension:

= Table.SelectRows(Source, each ([Extension] = ".xls"))

After migration, those files are now .xlsx. Update the filter:

= Table.SelectRows(Source, each ([Extension] = ".xlsx"))

If you're in a mixed environment where some files are already converted and others aren't yet, you can temporarily use an or condition:

= Table.SelectRows(Source, each ([Extension] = ".xls" or [Extension] = ".xlsx"))

Clean this up to .xlsx only once all files in the folder are converted.

After Fixing: Validate Your Query Output

Once you've updated source paths, corrected data types, and fixed navigation steps, don't just check that the query runs — validate the output:

  1. Row count. Compare the row count in your refreshed query to what you had before migration. A sudden drop means rows are being filtered out due to type errors.
  2. Null counts. Add a Count Rows step filtered to null in key columns. An unexpected increase in nulls after migration usually means a type mismatch is silently coercing values.
  3. Aggregate totals. If your query feeds a sum, average, or count downstream, verify the totals match your pre-migration baseline.
  4. Edge cases. Test rows with the known edge cases from your original data: leading zeros, date boundary values, empty strings, very large numbers.

Migrating the Source Files Themselves

This guide assumes you already have .xlsx files to point your queries at. If your .xls files are the source of truth and you haven't converted them yet, a few things matter for Power Query compatibility:

LegacyLeaps's Excel conversion preserves named ranges, formatting, and sheet names exactly as they exist in the source file — so your Power Query connections survive the migration intact.

Ready to migrate your Excel files?

LegacyLeaps scans your .xls files and shows you exactly what's inside — named ranges, macros, ActiveX controls, external links — before you convert a single file. Free scan, no sign-up required.

Download Free Scanner

Frequently Asked Questions

Why does Power Query break when I convert .xls to .xlsx?

Power Query stores the data source file path in the M code. When you convert .xls to .xlsx, the file extension changes — even if the name and location stay the same. Power Query can't find a file called data.xls if it has been renamed to data.xlsx. You need to update the Source step in each affected query to point to the new .xlsx file.

Will my Power Query data types change after migrating from .xls to .xlsx?

They can. The .xls format uses the Jet engine for type inference, while .xlsx uses the Open XML format with stricter data type handling. Numbers stored as text in .xls sometimes become numeric in .xlsx, which breaks Power Query steps that expect text. Always check the Changed Type steps in your queries after migration and add explicit type conversions where needed.

How do I update Power Query to point to a new .xlsx file?

Open Power Query Editor (Data → Get Data → Launch Power Query Editor), select the affected query, click the Source step in the Applied Steps pane, and update the file path from .xls to .xlsx. If the same source file feeds multiple queries, use a parameter to store the file path so you only need to update it once.

Can I fix Power Query source paths in bulk for many files?

Yes. Use the Advanced Editor to view and edit M code directly. For workbooks with many queries sourcing the same .xls file, replace the hardcoded path in the Source step across all queries. A better long-term fix is to use a file path parameter that all queries reference — then you only update the parameter when the source file changes.

What Power Query functions change between .xls and .xlsx sources?

The core function stays the same: Excel.Workbook(File.Contents(...)). But you may need to set UseHeaders or InferColumnTypes parameters explicitly in the .xlsx version if the defaults produce different results than you saw with the .xls source. Named table references via Excel.CurrentWorkbook() work the same in both formats.

Get tips like this in your inbox

Practical fixes for legacy Excel and Access problems. No spam.

← Back to all posts