[Copilot Studio] I tried distributing a generated Word report as a download link via a flow

[Copilot Studio] I tried distributing a generated Word report as a download link via a flow

This article introduces, based on hands-on verification, how to distribute Word reports generated in Copilot Studio to users via agent flows. It explains the mechanism for operating end-to-end, from natural language requests through file generation, saving, and returning a sharing link.
2026.06.23

This page has been translated by machine translation. View original

Introduction

Hello, I'm Keema.

In Part 9, I used Copilot Studio's Document output to insert values into a template and generate a Word report.
However, one issue remained: when called from the agent's chat, the download link for the generated Word file did not appear in the chat.
Delivering the actual file to users requires one more step.

In this article, I verified (as of June 2026) the process of using Copilot Studio's agent flow to save the generated Word report to OneDrive and return a download sharing link to the chat.
The end-to-end flow goes: "request in natural language → agent selects a tool → Word is generated → download link is returned."
I hope this serves as a reference for those who want to have an agent create documents and automate distribution in one go.

Target audience: Those who want users to download files generated in Copilot Studio, and those who want to automate document distribution with agent flows.

Series Article List

This article is Part 11 of a series on building agents with Copilot Studio.
The series as a whole aims to build an agent that handles "collection → aggregation → charts → insights → documentation" end-to-end, and this article covers "distribution" of generated files as the finishing touch.

# Theme Article
Part 1 First agent Creating Your First Agent
Part 2 Knowledge Trying Knowledge-Based Answers Using Files
Part 3 Topics, Tools, Flows Building "Actions" with Topics, Tools, and Agent Flows
Part 4 Templates, Autonomous Triggers, Multi-Agent Expanding the Structure with Templates, Autonomous Triggers, and Multi-Agent
Part 5 Collection (how to pass data) Comparing Methods for Giving an Agent KPI Data for Aggregation
Part 6 Aggregation Performing KPI Aggregation Deterministically Without Relying on LLM
Part 7 Charts Displaying KPIs as Charts Inside the Chat
Part 8 Insights Generating Insights (Comparative Comments and Notable Points) from Aggregated Numbers
Part 9 Documentation (Word) Auto-Generating a Word Report by Inserting Values into a Template
Part 10 Documentation (PowerPoint / Excel) Generating .pptx/.xlsx from Scratch with Code Interpreter
Part 11 Distribution (This article)

1. What This Article Verifies

In Part 9, I created a prompt tool called "KPI Report Merge (Word)" that inserts values into placeholders in a Word template.
In this article, I call this prompt tool from an agent flow, save the generated Word to OneDrive, and return a download sharing link to the chat.

Specifically, I verify the following flow on an actual device:

  • Create an agent flow and save the prompt tool's output to OneDrive
  • Create a sharing link for the saved file and return it to the agent
  • Register the flow as a tool in the agent
  • Make a natural language request from the test chat and receive the download link

The verification uses the same KPI data (fictional) from three fictional SaaS companies (CloudNova / StreamForge / Datapeak) as in Part 9.

This article assumes that the template and prompt tool created in the documentation (Word) article are already prepared.

2. Why a Flow Is Needed

Even if you call a prompt tool from the agent's chat, the Word download link does not appear in the chat.
This is by design: the Document output result (Document Output Content Bytes) does not become a direct output in a topic or agent.

Unlike cloud flows and agent flows, the Document Output Content Bytes output isn't directly available as a node output in a topic. To allow a user to download the generated document in a topic, use a cloud flow as an intermediary to save the document and return a download link.

Source: Document output (preview) | Microsoft Learn

That is why we insert a flow in between.
The flow runs the prompt, saves the output as a file, creates a sharing link, and returns it to the agent.
The steps shown in the official documentation are as follows:

  1. Add a Run a prompt action and select the prompt created in Create a prompt with document output.
  2. Add the action Create file from OneDrive or SharePoint.
  3. From the prompt action in the File content field, select Document Output Content Bytes.
  4. Add a Create sharing link action for the file to generate a shareable download URL.
  5. Add a Return value(s) to Power Virtual Agents action and return the sharing link URL as an output variable.

Source: Document output (preview) | Microsoft Learn

We will assemble these steps as an agent flow.

3. Creating the Agent Flow

Open "Flows" from the left menu in Copilot Studio, and create a "New agent flow".
The final flow consists of the following 5 steps.

Overview of the completed agent flow
5 steps: Trigger → Run prompt → Create file → Create sharing link → Respond to agent

3.1 The Trigger Is "When an Agent Calls a Flow"

First, select the trigger.
This was the first stumbling point for me.

This flow is called from an agent and returns results to the agent.
Therefore, the trigger must be "When an agent calls a flow".
You can find it by searching for "Copilot" in the trigger search box.

State with the Skills connector trigger selected
Select the "When an agent calls a flow" trigger (Skills connector)

Since we are keeping data fixed on the prompt side this time, no trigger inputs are added.

3.2 Running the Prompt

After the trigger, add a "Run a prompt" action.
The first time, you will be asked to connect to Microsoft Dataverse, so sign in and create the connection.

From the prompt list, select "KPI Report Merge (Word)" created in Part 9.
This prompt has Document output configured and outputs a Word file with KPI data inserted.

3.3 Creating the File (OneDrive)

Next, add "Create file" (OneDrive for Business).
The first time, you will be asked to connect to OneDrive for Business, so sign in and create the connection.

Set the following three items:

  • Folder path: The destination folder. This time, select root (/)
  • File name: kpi-report-flow.docx
  • File content: Press / in the input field to open dynamic content, and select "Document Output Content Bytes" from the Run a prompt output

"Document Output Content Bytes" is the content of the Word file generated by Document output.

Create file. Specifying Document Output Content Bytes in File content
Save the generated Word content (Document Output Content Bytes) to OneDrive

Next, add "Create sharing link" (OneDrive for Business).
Set the following three items:

  • File: Press / to open dynamic content and select "ID" from the Create file output
  • Link type: View (view only)
  • Link scope: Organization (within the organization)

Setting the link scope to Organization
Set the link scope to Organization to create a sharing link limited to within the organization

3.5 Responding to the Agent

Finally, add "Respond to an agent" and return the sharing link URL to the agent.
From "Add an output", select "Text" as the output type, and configure as follows:

  • Output name: DocumentURL
  • Value: Press / to open dynamic content and select "Web URL" from the Create sharing link output

Respond to an agent. Returning the sharing link Web URL as DocumentURL
Return the sharing link Web URL to the agent as an output named DocumentURL

Once this is assembled, name the flow (in this case, "KPI Report Distribution Flow") and "Publish" it.
When publishing succeeds, "This agent flow has been published" is displayed.

4. Registering the Flow as an Agent Tool

Register the created flow as a tool so it can be called from the agent.
Open the agent's "Tools" tab, select "Add a tool" → "Flow", choose "KPI Report Distribution Flow" from the list, and click "Add and configure".

Adding a flow as a tool
Add the created flow as a tool in the agent

After adding, set the tool's description.
The description is used by the agent's orchestrator to decide which tool to select.
To differentiate it from the prompt tool in Part 9, I wrote a description that conveys the purpose of "returning a shareable download link."

Inserts KPIs for three SaaS companies (CloudNova/StreamForge/Datapeak) into a Word template, generates a KPI comparison report (Word document), saves it to OneDrive, and returns an organization-internal download sharing link (DocumentURL). Use this when you want to download the report as a file or need a sharing link.

Enter the description and "Save".

5. Verifying Operation in the Test Chat

Send a request from the agent's test chat that conveys the need for a download link.

Please create a KPI comparison report for the three companies in Word and return a shareable link I can download.

The first time, a card appears in the chat asking you to authorize the OneDrive for Business connection used by the flow.
Click "Allow" to approve the connection.

After approval, the agent automatically selects the flow tool and executes it.
In my environment, it took about 50 seconds for the flow to complete.
When finished, the agent returned a link saying "Download the KPI comparison report" along with a summary of the report.

Download link returned in the test chat
The flow was executed from a natural language request, and an organization-internal download link was returned

The returned link is a OneDrive sharing link in the format https://<tenant>-my.sharepoint.com/..., and clicking it allows you to download the Word file.
The agent's response also included a note: "This link is accessible only to members within the organization (your company's domain)."
This reflects the result of setting the link scope to Organization in step 3.4.

This confirmed that the end-to-end flow — "natural language request → tool selection → Word generation with template insertion → OneDrive save → return organization-internal sharing link" — works seamlessly.

6. Billing and Connectors

This flow uses OneDrive for Business (standard connector) and a Microsoft Dataverse connection for running the prompt.
Microsoft Dataverse is classified as a premium connector (listed in the official premium connector list).

Regarding billing, test chat runs and test runs from the flow designer do not consume capacity for agent flow actions.

Test runs: Testing an agent flow in the flow designer or from the agent's test chat doesn't consume capacity for agent flow actions. Test runs aren't blocked by enforcement.

Source: Billing rates and management | Microsoft Learn

Additionally, messages in the embedded test chat do not count toward billed sessions.

Messages in the embedded test chat don't count toward billed sessions.

Source: FAQ for Copilot Studio billing and licensing | Microsoft Learn

For the scope of this verification (template creation, flow building, test runs), you can try it without worrying about billing for these reasons.
On the other hand, billing in production use varies depending on the connector classification, license, and number of executions. Check the Power Platform Admin Center (Licensing > Copilot Studio) for prerequisites before production deployment.

7. Summary

A Word file generated with Document output cannot be distributed directly through the agent's chat.
By inserting an agent flow as the distribution boundary, you can save it to OneDrive and return an organization-internal sharing link.
In this verification, the entire flow — from a natural language request to Word generation, saving, and returning a sharing link — worked end-to-end.

When distribution is included, you also need to be mindful of the sharing link's access scope (default is anonymous), as well as the connector classification and billing.
Verification can be tried easily through test runs, but for production use, plan for channel publishing (user license) and connector/billing prerequisites.
In the next (final) installment, I will integrate all the steps covered so far (collection, aggregation, charts, insights, documentation, distribution) into a single agent.

References

Share this article