How to Remove or Undo a Custom Power Query Function in Excel
Question details
The user needs to locate and remove a custom Excel Power Query function that affects multiple connections and returns only file names.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Undoing an applied custom Power Query function that has altered the expected data output across multiple workbook connections.
- Observed behavior
- Affected queries are returning only file names instead of the actual extracted data contents, breaking the expected data flow in multiple connections.
Before modifying or deleting custom functions, duplicate your Excel workbook to ensure you have a safe backup in case dependent queries break during the removal process.
Remove the Custom Function and Restore Source Steps
Use this solution to manually delete the problematic function and reconfigure the dependent queries to their original state.
Because custom functions are often linked to multiple queries, deleting the function outright will cause errors in any query that references it. You must first inspect the dependencies, remove the function, and then fix the 'Applied Steps' in the affected queries.
Open your Excel workbook, navigate to the 'Data' tab on the top ribbon, and click on 'Queries & Connections' to open the side pane.
Double-click any query to open the Power Query Editor. Go to the 'View' tab and click 'Query Dependencies' to see a visual map of which queries rely on the custom function.
In the left-hand Queries pane of the Power Query Editor, locate the custom function (denoted by an 'fx' icon). Right-click the function and select 'Delete'.
Select each affected dependent query. In the 'Applied Steps' pane on the right, delete the step that invoked the custom function. You may need to click the gear icon next to the 'Source' step to manually re-point the query to the correct file contents rather than just the file names.
Once all errors are resolved, click 'Close & Load' on the Home tab to apply the changes back to your Excel workbook.
Try WPS Office for Seamless Data Management
Struggling with complex Power Query functions and broken connections in Excel? WPS Office provides a highly compatible, lightweight, and intuitive alternative for managing your spreadsheets and data without the steep learning curve.
- 1. Download WPS Office: Visit the official WPS website and download the free version of WPS Office.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your existing Excel (.xlsx) files directly with full formatting preserved.
- 3. Analyze Data Easily: Use the straightforward data processing tools in the 'Data' tab to clean and organize your tables without needing complex M-code or custom functions.

Frequently Asked Questions
How do I find all queries dependent on a custom function?
Open the Power Query Editor, go to the 'View' tab, and select 'Query Dependencies'. This will display a flowchart showing exactly which queries are linked to your custom function.
Can I undo a deleted custom function in Power Query?
If you have not yet closed the Power Query Editor, you can discard your changes by closing the editor and choosing not to keep changes. However, once you click 'Close & Load', the deletion cannot be undone, which is why a backup is recommended.
Why does my query only return file names instead of data?
This usually happens when the query is extracting folder metadata rather than expanding the file contents. To fix this, locate the 'Content' column in your Power Query Editor and click the double-arrow icon to expand the actual data inside the files.




