Blank query module in Power Query Online

The Blank query module lets you create a query by writing or pasting a Power Query M expression. Use it when you already have query code, need a custom expression, or want to generate data without starting from a connector dialog.

Screenshot of the Blank query module.

Start with an M expression

  1. In Get data, select Blank query.
  2. Write or paste your M expression into the script editor.
  3. If your host provides a Data gateway dropdown, choose the appropriate execution context as described in the next section.
  4. Select Next and review the query result.

For a self-contained example, paste this expression:

let
    Source = #table(
        type table [Product = text, Quantity = number],
        {
            {"Notebook", 10},
            {"Pen", 25}
        }
    )
in
    Source

This expression defines a two-row table with Product and Quantity columns. It doesn't connect to a live source. For the language syntax, go to Expressions, values, and let expression and #table.

When you copy code from another query, review references to other queries and parameters. A script that depends on a query or parameter that's not present in the current project isn't self-contained. Code that accesses a source still needs that source's permissions and credentials; pasting M code doesn't supply them.

Choose the gateway execution context

In hosts that support data gateways, a Data gateway dropdown appears below the script editor. Use it to choose the gateway context in which to run your query.

For example, if your script accesses a source that requires a gateway, choose the appropriate gateway before continuing. The gateway dropdown doesn't appear in every host.

For information about how gateways and credentials participate in a connection, see Connections and authentication in Power Query Online.