Use Power Query to import and reshape data, Office Scripts to control work inside an Excel workbook, and Power Automate to coordinate the reporting workflow. A report may need two or all three. Choose each part by the job it must perform and prove how fresh data reaches the finished report before scheduling delivery.
The critical distinction is refresh. A script that works when someone opens Excel does not automatically make the same workbook refresh correctly inside a cloud flow.
This guide helps an operations owner decide where each tool belongs. For a worked reporting workbook and setup guide, use the weekly Excel reporting walkthrough.
Assign each reporting task to a tool
Start with a list of the work people currently do: collect exports, tidy columns, calculate totals, format the result, ask for review and distribute it. Separate those tasks before comparing products.
| Reporting task | Starting choice | What to establish |
|---|---|---|
| Combine supported source files and standardize their columns | Power Query | Which inputs and transformations produce the reporting table. |
| Apply workbook logic, inspect named ranges or format an output sheet | Office Scripts | Which workbook objects the script reads or changes. |
| Start on a schedule, call connected services and route a draft | Power Automate | The trigger, connections and outcome of each step. |
| Approve a report before distribution | A review step coordinated by the workflow | Who decides, which version they see and what blocks delivery. |
Microsoft’s comparison of Power Query and Office Scripts describes their different strengths in data preparation and workbook control. It also describes how scripts can exchange information with a flow. The table above is a planning framework, not a claim that these tools provide every control automatically.
Keep a calculation in the place your team can understand and maintain. Adding a script is useful when it resolves a specific workbook task. It adds another thing to support when it only reproduces a simple calculation someone already trusts.
Check the refresh path before calling it unattended
Power Automate can invoke a script without someone opening the workbook. That does not mean the script can refresh every external connection or PivotTable.
Microsoft documents important differences when scripts run in flows. Most refresh methods do nothing in that context. The documented exception for Workbook.refreshAllDataConnections is Power BI sources; it is not a general way to refresh an Excel Power Query connection. Some calls can return successfully without updating the data.
Ask the person implementing the workflow to demonstrate the exact source-to-report path in your environment. Change a source record, run the cloud workflow with the workbook closed, and check that the finished report includes the change. Record a source batch identifier and the period through which the data is complete. The time a flow ran is not evidence that its source was current.
If the process still requires someone to refresh the workbook, describe it as a partly automated process and assign that responsibility. Alternatively, test a supported way to load the required data before the reporting step. Do not promise unattended refresh on the strength of a successful Run script action alone.
Work through a reporting handoff
Consider a hypothetical service company that combines exports from two teams. This is an illustrative design exercise, not a tested integration or a Codi client result.
The two exports contain 40 and 25 distinct jobs in the agreed period. After checking identifiers and statuses, the combined table has 65 jobs: 57 closed and eight canceled. Four of the closed jobs have no team assigned.
| Stage | Proposed responsibility | Evidence passed forward |
|---|---|---|
| Prepare the input | Use Power Query to combine the agreed exports and join the approved team lookup. Test how this preparation is refreshed in the actual environment. | Source batch IDs, reporting boundaries and the materialized table. |
| Check the workbook | Use an Office Script to inspect the prepared table and produce a draft breakdown. | 65 total jobs, 57 closed, eight canceled and four missing-team exceptions. |
| Decide what happens next | Use the flow to inspect the returned result and route exceptions to the process owner. | Hold the team report until those four assignments are resolved or an explicit exception is approved. |
| Release the reviewed version | Coordinate approval and delivery, with a durable delivery record. | The approved draft version and whether that version was sent. |
The arithmetic balances: 40 + 25 = 65, and 57 + 8 = 65. That does not make the team breakdown ready. Resolving the four missing assignments is a separate condition.
Now suppose the script reads yesterday’s prepared table because the refresh never happened. Its totals may still balance. The workflow needs to reject the wrong source batch as well as an incorrect total. This is why the import, workbook checks and delivery decision need a clear handoff.
Use the First AI Project Kit to record those handoffs and owners. It includes a playbook and editable worksheet. The useful output is a reporting process your team can explain, including what happens when the source is late.
Confirm access and execution limits
Before selecting the implementation, confirm that the people operating it have the required licenses, file access and administrator approval. Microsoft’s Office Scripts integration guidance requires a business Microsoft 365 license for using scripts with Power Automate. Check the actual subscription and connections rather than assuming that an Automate tab covers the full design.
The execution environment also changes what a script can do. Microsoft’s Office Scripts limits explain that external API calls from a script fail when it runs through Power Automate. Put required service calls in appropriate flow actions and check their permissions and licensing. Test representative data volumes and execution times before committing to the design.
For workbook storage and access, check the Excel Online (Business) connector’s supported locations and limitations. Coordinate writes so that a reviewer, a data-loading process and the flow are not all changing the same reporting input at once. A separate snapshot for each run can make review and investigation easier.
Name the person who maintains the query, script and flow. Also name who can restore a failed connection and who decides to use the manual fallback. A workflow is difficult to operate if the only person who understands its logic is no longer available.
Prove the result before expanding it
Use a small acceptance checklist before adding more reports:
- A changed source record reaches the finished draft through the actual cloud execution path.
- A late or incomplete source holds delivery even when the workbook calculations succeed.
- A missing column, unexpected team or duplicate identifier gets an understandable exception.
- A changed draft requires review of the changed version.
- A retry cannot silently send the same report twice.
Set the reporting time zone explicitly when configuring the scheduled cloud flow. Pass the agreed reporting period into the work, and test boundary dates rather than relying on whichever date a workbook session happens to use.
Use rules for checks that have an exact answer. If you later add AI commentary, keep it downstream of the checked figures and retain a human decision about explanations the data cannot support. The AI-versus-rules guide helps separate those choices.
The right combination is the smallest one that gets current data into a checked report your team can maintain and release reliably. Measure preparation, checking and correction time together, using the ROI guide, before deciding whether another layer of automation is worthwhile.