Search code examples
excelpowerpivotpowerquery

How to password protect Power Query queries?


I have a power pivot model generated from Power Query.

I'd like to hide the Power Query code from being seen by the users.

Is there a way to password protect the queries, but still allow the users to connect to and refresh the query?


Solution

  • At the moment, it is not possible with Power Query to protect the queries from the user viewing the code, or steps that make up a query.

    If a user can view the query, they can inherently view the code or steps used to create the query.

    What you could do is:

    Make the query like your normally would, then once your new table is on your new sheet, thanks to power query, click on that table (to select it), click on: Data> From Table...

    This will make a new query, based on the first query you made, except, the difference here is that now there's only one step, namely the "Source" step.

    Any updates to the original query, will reflect on the 2nd one when you hit "Refresh".

    (Doing this is the same as right clicking on the query inside the pane on the right and selecting "Reference")

    But - Power Query has been recently updated, adding in some much needed functionality, so who knows, maybe in the very near future, we'll be able to protect our queries, but right now, we cannot simply "Protect" them...

    I would try out what Mike said, by trying out Power BI for free, and uploading them to the net, and accessing them from there... I do not own Power BI, so I can't speak for myself here, but from what I've read, you may be able to accomplish some of what needs to be done.

    Or a much easier way, duplicate current query, copy formula (in advanced editor), make new workbook, create query and paste formula in, in 1st workbook, delete formula and click on new source and navigate to your query. Ta, no code.