You connect Power Query and Power Automate by putting Power Query inside the Dataflows (or Dataflow Gen2) feature of Power BI or Power Apps, then having a flow refresh that dataflow on a schedule and act on the result. Power Query is the data-prep engine — it cleans and shapes tables — and Power Automate is the automation engine that moves things, sends notifications, and runs on triggers. They do not sit side by side on your desktop; the dataflow is the bridge. The usual pattern is: build your queries in a dataflow, load them to a destination, then let a scheduled cloud flow refresh the dataflow and notify you or hand the cleaned data to another app.
What You'll Need
- A work or school (Microsoft 365) account. Consumer accounts have limited dataflow support, so check your subscription before you start.
- Access to Power BI (with dataflow or Dataflow Gen2 support) or Power Apps, which is where the dataflow is authored.
- A Power Automate licence that allows the dataflow connector — a premium licence is often required for the Power BI dataflow trigger and action, so confirm your plan.
- Credentials for the source system you are pulling data from (SharePoint, SQL, Excel workbook, Dataverse, a web API, and so on).
- Permission to create or at least refresh the dataflow, and permission to create flows in the same environment.
- Agreed destination: a Power BI dataset, a Dataverse table, a SharePoint list or a storage account — decide before you build, because it shapes the queries.
Step-by-Step
- Decide what the automation should do. Write one sentence: for example, "every morning, refresh sales data and email the row count to the team." Power Query does the cleaning; Power Automate does the scheduling and the action. Keeping the two jobs separate stops you from over-building queries.
- Open the dataflow editor. In Power BI Service, go to your workspace and choose New > Dataflow (or Dataflow Gen2, depending on your environment). In Power Apps, the equivalent lives under Data > Dataflows. Menu labels differ slightly by product version and region, so look for the dataflow option under "New" rather than hunting for an exact wording.
- Add your source. Use Get data, pick the connector that matches your system, and enter the credentials. Prefer connectors that support refresh through a gateway or cloud connection; if the source is an on-premises database, you will need a data gateway installed and registered first.
- Shape the data in Power Query Online. The editor works much like the desktop version: remove columns you do not need, set correct data types (especially dates and numbers), filter out blank rows, rename columns to consistent names, and merge or append tables if needed. Give every query a clear name, because Power Automate will reference that name.
- Check for query folding where you can. With database sources, keep transformations that fold back to the source (filters, column selection, simple joins) early in the query. Heavy steps that break folding slow refresh and can hit timeouts once the flow runs unattended.
- Set the destination. Choose where the output lands — a Power BI dataset, a Dataverse table, or another supported sink. Confirm the destination table has the right column types; mismatches are the most common reason a refresh succeeds in the editor but fails later.
- Save and do a manual refresh. Save the dataflow, then run Refresh now and watch it complete. Do not move on until a manual refresh finishes cleanly, because the flow will only repeat what the dataflow can already do.
- Create the flow. In Power Automate, choose Create > Scheduled cloud flow, set the start date, time and recurrence (for example, daily at 06:00 in your time zone). Add an action from the Power BI connector such as Refresh a dataflow and select your workspace and dataflow by name.
- Add a wait or a status check. Refreshes are asynchronous. Add a delay or a polling step, then check the refresh status before taking the next action, so your flow does not read stale numbers or fire an alert on a failed refresh.
- Add the action you actually wanted. Send an email or Teams message, write a row to SharePoint, post to an HTTP endpoint, or start an approval. Use dynamic content from the refresh result rather than typing values by hand.
- Test with a manual run. Run the flow with the Run button and inspect each step's inputs and outputs. Confirm the dataflow refreshed at the expected time and the notification arrived with correct values.
- Harden it. Add error handling: configure Run after so a failure branch sends an alert to you, and consider a retry policy on the refresh action. Then confirm the flow's owner has the permissions to refresh the dataflow — if that person leaves, the flow breaks, so use a shared service account or reassign ownership deliberately.
Common Mistakes
The biggest one is confusing Power Query Desktop with a dataflow. Queries built in Excel or Power BI Desktop are local; Power Automate cannot refresh them. Only a published dataflow (or a dataset refresh) is reachable from a flow. The second is assuming the refresh action waits for completion — it usually starts the refresh and returns, so any step immediately after may run against old data. Third, people break query folding with a step added late in the query, which works in testing but times out in scheduled runs. Fourth, credentials expire or are tied to one person's account, so the flow silently fails when that person changes roles. Fifth, data type mismatches between the query output and the destination table are ignored in the editor and only surface during a scheduled refresh.
Tips
Name dataflows, queries and flow actions consistently so the connector pickers make sense months later. Keep one dataflow per source system rather than one giant dataflow per report; refresh is faster and failures are easier to isolate. Use parameters in Power Query for things like date ranges so the flow can pass values in rather than you editing queries. Put a small "heartbeat" check in the flow — for example, verify the row count is above zero — before sending a report, so an empty refresh does not go out as real data. Schedule refreshes outside business hours and stagger multiple flows so they do not compete for the same source. Finally, keep a short note of which flow refreshes which dataflow and who owns it; that note saves hours when something fails.
Troubleshooting
The refresh action fails with a permissions error. Check that the flow's connection uses an account with refresh rights on the dataflow, then sign out and reconnect the Power BI connector. Confirm the flow and dataflow live in the same environment.
The manual refresh works but the scheduled one fails. Scheduled runs are unattended, so they cannot use interactive prompts or gateway credentials that need a sign-in. Check the gateway is online and its credentials are stored, and review the dataflow's refresh history for the actual error message.
The flow runs but the data is old. You are almost certainly reading before the refresh finishes. Add a delay or status check, and verify the flow time zone matches the dataflow's schedule.
Refresh times out. Look for steps that break query folding, trim columns early, filter at the source, and split a very large query into several smaller dataflows. If a source is slow, consider loading to a staging destination first.
The destination columns are wrong or missing. Recheck data types in Power Query and the destination table schema; adding a column usually requires updating the destination too.
Frequently Asked Questions
Can Power Automate run a Power Query directly?
Not a desktop query. It can refresh a published dataflow or a dataset through the Power BI connector, which runs the Power Query logic stored in that dataflow.
Do I need a premium licence?
Often yes for the dataflow refresh actions and for Dataflow Gen2 features. Check your plan, because entitlements vary by product and region.
Can the flow pass a parameter into Power Query?
Yes, if you define a parameter in the dataflow and the connector action exposes it. Otherwise edit the dataflow itself.
Will the flow tell me if the refresh failed?
Only if you build it. Add a failure branch using Run after so a failed step sends you an alert; by default a failed run just shows as failed in the run history.
Can I refresh an Excel workbook's Power Query from a flow?
Not by refreshing Excel directly. Move the query into a dataflow and refresh that instead, or use the Excel connector for simpler file operations.
What happens if the flow owner leaves?
The flow keeps its connections until they are revoked. Add a co-owner or service account so refreshes continue without interruption.