Prevent Copying Power Query Queries in a Protected Excel Workbook
Question details
The user wants to prevent people from copying Power Query queries while retaining workbook protection.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- A protected Excel workbook contains Power Query queries that should not be copied into another workbook.
- Observed behavior
- Users can copy Power Query queries even when workbook structure protection is enabled.
Identify who needs to open the workbook and who should have access to its queries and source data. Check whether your organization provides SharePoint permissions or sensitivity labels.
Restrict access to the workbook and its data sources
Use file and source permissions to limit who can inspect the workbook's queries and retrieve confidential data.
Excel workbook structure protection is not a security boundary for Power Query definitions. People who can open the workbook may be able to inspect or copy its queries.
Encryption and sharing permissions control access to the file; they do not guarantee that an authorized user cannot copy a query.
In Excel, open the Review tab and check Protect Workbook to confirm that structure protection remains enabled.
If the workbook is stored in SharePoint or OneDrive, select the file and open Manage access. Remove unnecessary access and share it only with approved people.
If your organization uses sensitivity labels, open Sensitivity in Excel and select an appropriate label configured to restrict access or encrypt the file.
In the database, cloud service, or other source used by the queries, review its access-control settings and grant data access only to authorized accounts.

Share results without distributing the Power Query definitions
Use this approach when recipients need the results but should not receive the original queries.
Use WPS Office for Everyday Spreadsheet Work
WPS Office is a free, lightweight alternative with a familiar interface and support for Microsoft Office formats, making it easier to move everyday spreadsheet work. It does not fix Excel's Power Query protection limitations.

Frequently Asked Questions
Does Protect Workbook stop users from copying Power Query queries?
No. Review > Protect Workbook protects workbook structure, but it is not a security boundary for Power Query definitions.
Can I let users see results without giving them the queries?
Yes. Copy the needed result cells into a new workbook using Paste Special > Values, then check Data > Queries & Connections before sharing the new file.
Will encrypting an Excel workbook prevent an authorized user from copying a query?
No. Encryption can restrict who opens the file, but an authorized user who can open it may still be able to inspect or copy its queries.
Can VBA reliably block query copying?
No. VBA that clears copy mode can discourage ordinary copying, but users can disable macros or bypass the code. Use file and data-source permissions instead.




