---
title: "Build a Power Automate Desktop Flow That Exports a Report and Emails It Daily at 7am"
date: 2026-05-26T00:00:00.000Z
updated: 2026-06-27T10:23:03Z
tags: ["Power BI", "Excel", "Automation"]
canonical: https://bianca.codes/blog/build-a-power-automate-desktop-flow-that-exports-a-report-and-emails-it-daily-at-7am/
---

# Build a Power Automate Desktop Flow That Exports a Report and Emails It Daily at 7am

_Step-by-step from a blank flow, including how to handle the parts that break the first time._

You're going to build a desktop flow that opens an Excel workbook on a shared drive, exports it as PDF, saves the file with today's date in the name, and emails it to a distribution list. Then a cloud flow triggers it every weekday at 7am, on a Windows host that stays on overnight.

End state: a PDF lands in the distribution list's inbox before anyone is at their desk, named `Sales-Daily-2026-05-26.pdf`. Nobody clicks anything. Nobody is logged in. If the workbook is broken, the flow fails loudly and someone gets a notification.

You'll need Power Automate Desktop installed (free download), a Power Automate Premium licence on the gateway machine for the unattended run, a Windows host that stays on and signed in, the Excel file on a path the host can reach, and an Outlook profile or an SMTP service account the host can send from. If the report is a Power BI Desktop file instead of Excel, the steps are the same with one swap noted later.

## Why this approach

The obvious alternative is a Power BI subscription, or Excel's built-in `Send as PDF` from a personal mailbox. Both have the same problem: they need someone signed in, or they break the moment that person leaves the company. Subscriptions also can't run a workbook that depends on local data sources, which is half the real-world reports that need this in the first place.

A desktop flow on a dedicated host runs whether anyone is in the office or not. The schedule lives in a cloud flow, which means it shows up in Power Automate run history alongside everything else you own, and the credentials live in the gateway, which means turnover doesn't break it.

## Step 1: Build a blank desktop flow

Open Power Automate Desktop. Click **+ New flow**. Name it `Daily Sales PDF Export`. Click **Create**.

The empty designer opens. Three panes: actions on the left, the flow canvas in the middle, variables on the right. You build by dragging actions onto the canvas.

## Step 2: Get today's date into a variable

Drag the **Get current date and time** action onto the canvas. In the action properties, leave **Retrieve** set to `Current date and time`. In the produced variable, rename it from `CurrentDateTime` to `TodayStamp`.

Now drag a **Convert datetime to text** action below it. Set **Datetime to convert** to `%TodayStamp%`. Set **Format to use** to `Custom` and put `yyyy-MM-dd` in the format field. Rename the produced variable to `TodayString`.

``

`%TodayString%` now holds something like `2026-05-26`. You'll use it in the filename and the email subject.

## Step 3: Open the Excel file

Drag the **Launch Excel** action. Set **Launch Excel** to `and open the following document`. Set **Document path** to the full UNC path to the workbook, for example `\\fileserver\reports\Sales-Daily-Template.xlsx`. Set **Make instance visible** to `false` for unattended use. Leave the produced variable as `ExcelInstance`.

If the workbook needs to refresh data on open, this is also where it happens. The default Excel behaviour - refresh on open - is your friend here. If your workbook doesn't refresh on open, add an **Excel: Run macro** action immediately after to call a `RefreshAll` sub.

For a Power BI Desktop file instead of Excel, replace this step with a **Run application** action pointing to `PBIDesktop.exe`, with the `.pbix` path as an argument. The export step a few steps later changes too, but everything else is identical.

## Step 4: Save the workbook as PDF with today's date

Drag the **Save Excel** action. Set **Save mode** to `Save document as`. Set **Document format** to `PDF Document (*.pdf)`. Set **Document path** to:

vba

\\\\fileserver\\reports\\exports\\Sales-Daily-%TodayString%.pdf

The `%TodayString%` token interpolates the variable into the path. The exported file name will be `Sales-Daily-2026-05-26.pdf`.

For a Power BI Desktop export, use **UI automation** actions instead: focus the Power BI Desktop window, click `File > Export > Export to PDF`, then handle the save dialog with a **Populate text field in window** action for the filename. Slower, more brittle, but works.

## Step 5: Close Excel cleanly

Drag a **Close Excel** action. Set **Excel instance** to `%ExcelInstance%`. Set **Before closing Excel** to `Do not save document`. The PDF is already on disk, so there's no reason to save the working copy.

If you leave Excel open between runs, the next morning's flow will find a stuck instance and fail in a confusing way. Always close.

## Step 6: Send the PDF as an email attachment

Drag a **Send email** action (or **Send Outlook email message** if the host has Outlook installed, which is more reliable). Set:

- **From**: the service account address
- **To**: the distribution list
- **Subject**: `Daily Sales Report - %TodayString%`
- **Body**: `Today's sales report is attached.` (Plain text. Don't waste a paragraph.)
- **Attachments**: `\\fileserver\reports\exports\Sales-Daily-%TodayString%.pdf`

For Outlook, leave the SMTP settings alone and let the desktop profile handle authentication. For the generic Send email action, you need SMTP server, port, and a service account credential stored in the Power Automate vault, not in the action body.

## Step 7: Add a failure path

Wrap Steps 3 to 6 in an **On block error** region. Inside the error region, add a **Send email** action that sends a one-line failure notice to your own address, including `%LastError%`. This is the difference between "the report didn't arrive this morning" and "the report didn't arrive this morning and now I have to reconstruct what happened from logs that don't exist."

## Step 8: Save the desktop flow and connect it to a cloud trigger

Save the flow. Close the designer.

Open `make.powerautomate.com`. Create a new cloud flow with a **Recurrence** trigger set to run weekdays at 7am in your timezone. Add a **Run a flow built with Power Automate for desktop** action. Pick the host machine and select `Daily Sales PDF Export`. Set the run mode to `Unattended`. Save.

This is the half people forget. A desktop flow on its own can't schedule itself. The cloud flow is the scheduler; the desktop flow is the worker.

## Common mistakes

****

### **Leaving Excel visible during unattended runs.**

If `Make instance visible` is set to `true` and the flow runs unattended, Excel pops up on the host machine, sometimes behind the lock screen, and the flow hangs waiting for a UI it can't see. Set it to `false` for unattended use. If you're debugging, set it to `true` temporarily, then flip it back.

****

### **Hardcoding paths that work on your laptop and nowhere else.**

`C:\Users\bianca\Documents\Sales.xlsx` works in development and breaks the moment the flow runs on the gateway host. Use UNC paths to the shared drive (`\\server\share\...`) or a path that exists on the host machine. Test on the host, not on your laptop.

****

### **Forgetting timezones in the cloud flow recurrence.**

The recurrence trigger defaults to UTC. If you set it to 7am UTC, it runs at 5pm in Sydney. Open the recurrence trigger's advanced options, set the timezone explicitly, and confirm the next-run timestamp in the trigger preview before saving.

****

### **Not handling the failure path.**

The flow that silently doesn't run is worse than the flow that fails noisily. Always add the on-block-error region with a self-notification. The day you actually need it is the day after a vendor breaks the report template, and by then you can't go back and add it.

## Where to go from here

For the conceptual framing on when Power Automate Desktop is the right tool at all, see yesterday's Magic Monday: [Power Automate Desktop: The Automation Layer That Connects the Apps That Don't Have APIs](/blog/power-automate-desktop-magic-monday/).

For the wider question of whether this report should have been automated in the first place, see [The Deep End on automation decisions](/blog/not-everything-should-be-automated-heres-how-to-tell-the-difference/) (May 24).

## Frequently Asked Questions

****

### **Can I run this on my own laptop instead of a dedicated host?**

You can for an attended flow, but it stops working the moment you close the lid, sign out, or someone else needs your machine for a Teams call. Unattended scheduling needs a host that stays on and signed in. A small VM, a spare desktop in a server cupboard, or an Azure VM with the on-premises data gateway installed are all fine. A laptop is not.

****

### **Does the host machine need Excel installed?**

Yes if the report is an Excel file. The Launch Excel action drives an actual Excel process. The same goes for Power BI Desktop or any other application the flow opens. The host needs the software the flow uses, licensed and installed.

****

### **What licence do I need for unattended runs?**

A Power Automate Premium licence (per user per machine) on the host. The Process plan is the right shape if you're running multiple unattended flows or sharing a host across a team. Attended runs are included in most M365 plans, but they can't be scheduled to run with no user signed in.

****

### **Can I do this with a Power BI subscription instead?**

If the report lives in the Power BI service and refreshes from cloud sources, yes. Power BI subscriptions are simpler and don't need a host machine. The reason this whole pattern exists is for reports that depend on local files, legacy systems, or anything that won't move to the service. If your report can live in Power BI service, put it there.

****

### **How do I store the SMTP credentials securely?**

Use Power Automate's credential vault rather than hardcoding the password into the Send email action. In the desktop flow designer, create a new credential under `Settings > Credentials` and reference it by name in the action. The password is encrypted at rest and never visible in the flow source.

****

### **What happens if the Excel file is locked by another user?**

The Launch Excel action fails with a file-in-use error. The on-block-error path catches it and emails you. The right fix is upstream: make sure the source workbook isn't being edited at 7am, or use a template-and-copy pattern where the flow operates on a fresh copy each morning rather than the live file.
