Creating a Slide Generator Agent in Copilot Studio
Use generative AI to populate a PowerPoint template on demand and deliver the finished file directly in a conversation.
Imagine a project manager who needs to produce a weekly status summary slide for leadership. Instead of manually updating a presentation every week, they can ask a Copilot Studio agent to do it. The agent takes a few key inputs—project name, status colour, highlights, next steps, and author—then generates a PowerPoint file from a pre‑designed template and hands back a download link.
Behind the scenes, a prompt action uses the template’s named shapes to insert the values, and an agent flow saves the result to OneDrive. The finished file never leaves your tenant. This walkthrough shows you how to build the same pattern for your own reporting or certificate needs.
Setting Up the PowerPoint Template
The agent works by editing text boxes that have meaningful names inside a PowerPoint file. Start by creating a new .pptx file based on a simple slide layout (for example, the built‑in “Title and Content” or a blank slide). Add five text boxes and rename them through the Selection Pane (Alt+F10) to the following:
ProjectNameStatusIndicatorSummaryTextNextStepsPreparedBy
Set the initial text of each box to something like {{ProjectName}} so you know which is which during testing, then delete that placeholder text. The final template should contain only the empty shapes with their assigned names.
Save the file as ProjectStatusReport.pptx and upload it to a central document library (for example, Project Templates) on a SharePoint site that everyone who will use the agent can access.
Building the Prompt Action
In Copilot Studio, go to the Prompts page and create a new prompt action. Give it a descriptive name like Fill‑PPT‑From‑Template.
Provide the following instruction:
- Open the PowerPoint template from the input [Template File].
- Read the shape names in the slide.
- For each shape name, set its text content according to the mapping below:
- “ProjectName” → [Project Name]
- “StatusIndicator” → [Status] (use a coloured emoji like 🟢, 🟡, 🔴)
- “SummaryText” → [Summary]
- “NextSteps” → [Next Steps]
- “PreparedBy” → [Prepared By]
- Output the modified PowerPoint file.
Add the following input fields to the prompt:
Template File(type File)Project Name(type Text)Status(type Text)Summary(type Text)Next Steps(type Text)Prepared By(type Text)
Open the Settings panel for the prompt and enable Code Interpreter. This feature is necessary for the prompt to receive and output file attachments. Without it, the prompt cannot access the PowerPoint binary data.
Set the output type to Documents & Images and run a test with the sample template and some dummy values. Download the result to verify that the named shapes were filled correctly.
Creating the Agent Flow
The agent flow orchestrates fetching the template, calling the prompt, saving the generated file, and returning a download link. Add a new Agent Flow tool to your agent and define these inputs:
ProjectName(Text)Status(Text)Summary(Text)NextSteps(Text)PreparedBy(Text)
1. Get the Template from SharePoint
Use the SharePoint – Get File Content Using Path action. Point it to the ProjectStatusReport.pptx file in your document library. Store the file content (binary) in a variable for later use.
2. Run the Prompt Action
Add a Run a Prompt action and select the prompt you created earlier. Map the trigger inputs as follows:
- Template File → the file content from the SharePoint action
- Project Name →
ProjectNametrigger input - Status →
Statustrigger input - Summary →
Summarytrigger input - Next Steps →
NextStepstrigger input - Prepared By →
PreparedBytrigger input
The output of this action will be a JSON object containing the generated file in Base64‑encoded form.
3. Save the File to OneDrive
Use a OneDrive for Business – Create File action. For the file name, generate a unique value so that each run creates a new file:
concat('StatusReport_', rand(1000, 9999), '.pptx')For the file content, you must convert the Base64 string from the prompt output back to binary. The formula depends on the structure of the prompt response; typically it looks like:
base64ToBinary(first(outputs('Run_a_prompt')?['body']?['responsev2']?['predictionOutput']?['files'])?['base64_content'])The property path inside the prompt output may vary between Copilot Studio versions. Inspect the raw outputs in a test run to confirm the correct path.
4. Build a Downloadable Link
To send the file back to the agent, you need the full URL to the file on OneDrive. Start by getting the current user’s profile with the Office 365 Users – Get My Profile (V2) action. Then use a Compose action to assemble the URL.
The domain name (e.g., contoso-my.sharepoint.com) can be obtained by looking at your OneDrive address bar. Store it in a string variable.
Your User Principal Name (UPN) contains characters (@ and .) that are unsafe for URLs. Replace them with underscores:
replace(replace(outputs('Get_my_profile_(V2)')?['body/userPrincipalName'], '@', '_'), '.', '_')Construct the full path:
concat('https://contoso-my.sharepoint.com/personal/', uriComponent(outputs('Compose_-_UPN_clean')), '/Documents/ProjectStatus/', outputs('Compose_-_File_Name'))Finally, encode the entire URL so the agent can handle it correctly:
encodeUriComponent(outputs('Compose_-_Full_Path'))5. Respond to the Agent
Add a Respond to the Agent action. Include a text output variable, for example FileLink, and set its value to the encoded URL. The agent will use this link to present a clickable download to the user.
Configuring the Tool in Copilot Studio
Back in the agent, open the flow tool (the one you created earlier) and modify its description. A good description helps the copilot understand when to call it:
Use this tool when the user wants to create a project status report slide. It generates a PowerPoint file from a template and returns a download link.
Also add descriptions for each input variable. For instance:
- ProjectName: the name of the project being reported on
- Status: overall status as “Green”, “Yellow”, or “Red”
- Summary: short paragraph summarising progress
- NextSteps: list of upcoming actions
- PreparedBy: name of the person preparing the report
Now update the agent's Instructions (found in the Overview tab) so that it knows when to invoke the flow:
When a project status report is requested:
- Ask for the project name, status, summary, next steps, and author name.
- Call the Generate Status Report flow with those values.
- Return the download link provided by the flow.
Save and publish the agent.
Testing the Agent
Open the test chat pane and type a request like “Create a status report for the Apollo launch system – status green, summary: propulsion tests complete, next steps: integrate guidance module, prepared by Dr. Carver.”
The agent should respond with a text confirmation and a download link. Click the link to open the generated PowerPoint and verify that the shapes are correctly filled.
Common Pitfalls and Troubleshooting
- Code interpreter not enabled: The prompt will fail silently or return an error if code interpreter is off. Double‑check the prompt settings.
- Shape name mismatch: The prompt relies on exact shape names as they appear in the Selection Pane. A trailing space or a renamed shape will cause the prompt to skip that field.
- Base64 conversion: If the file content looks corrupted, the Base64‑to‑binary path in your flow may be incorrect. Use the Compose action to inspect the raw prompt output during a test.
- File size limits: Agent flow responses are capped. Returning only a link (instead of the file content) avoids hitting that limit. If you need to send the file itself, consider storing it in SharePoint and passing the link.
Closing Thoughts
Combining Copilot Studio’s prompt actions with a custom agent flow makes it straightforward to turn a static PowerPoint template into a dynamic document generator. The same pattern can be reused for certificates, sales decks, or any other slide deck that follows a repeatable format. By keeping the template simple and relying on named shapes, you avoid the need for complex Office add‑ins or VBA macros—everything is driven by natural language and low‑code.
References
- Original source article by Matthew Devaney: Copilot Studio: Generate PowerPoint File From A Template
- Microsoft Learn: Create and use prompt actions in Copilot Studio (check for the latest version)
- Microsoft Learn: Agent flows overview
From multi‑branch condition blocks to a built‑in human review step, learn how to build resilient approval processes that combine AI logic with real‑world oversight.
Discover how the hidden EditTable YAML node lets you dynamically add, remove, or clear table variables directly inside your copilot conversations.
Connect any model from Azure AI Foundry—open source or custom—to Copilot Studio prompt actions.