How to Send a Selected Power Apps Gallery File by Email
Question details
The user wants to know how to set up a Power Apps gallery that allows users to select a specific template file and send it as an email attachment.

- Product
- Power Apps
- Device & OS
- not provided
- Scenario
- Building an application in Power Apps where users interact with a gallery of files and need a button to email the selected file to themselves or others.
- Observed behavior
- Requires a method to capture the selected file's identifier from the gallery, retrieve its content from the storage library, and execute an email sending process.
Ensure you have active licenses for Microsoft Power Apps and Power Automate, and that your template files are stored in a cloud-accessible location such as SharePoint or OneDrive.
Connect Power Apps to a Power Automate Flow
Create a Power Automate flow triggered by Power Apps to securely retrieve the file content and send it via the Office 365 Outlook connector.
While Power Apps has an Office 365 Outlook connector, handling complex binary file content directly from a gallery can be challenging. Passing the file identifier to Power Automate and letting the flow handle the attachment retrieval is the most robust and recommended solution.
Navigate to Power Automate, create a new 'Instant cloud flow', and select 'PowerApps' as the trigger.
Add the 'Get file content' action (e.g., for SharePoint or OneDrive). Click inside the File Identifier field and select 'Ask in PowerApps' from the dynamic content menu to create a variable.
Add the 'Send an email (V2)' action from the Office 365 Outlook connector. Fill out the To, Subject, and Body fields. You can also use 'Ask in PowerApps' for the recipient's email address if it needs to be dynamic.
In the 'Send an email (V2)' action, expand the advanced options. In the 'Attachments Name' field, enter the file name with its extension. In the 'Attachments Content' field, select the output from the 'Get file content' action.
Go back to your Power Apps canvas. Select the email button inside your gallery. In the top ribbon, click 'Action' > 'Power Automate' and add your new flow. Update the button's OnSelect property to run the flow, passing the selected item's ID and recipient email as parameters (e.g., `YourFlowName.Run(ThisItem.ID, User().Email)`).

Consult the Power Apps Community for Custom Scenarios
If your files are stored in a complex database or a custom asset library, seek specific template guidance from the Power Platform Community.
Switch to WPS Office for Seamless Template Management
Before automating document workflows in Power Apps, you need a reliable way to create and edit your templates. WPS Office provides a free, lightweight suite to manage your Word, Excel, and PowerPoint files flawlessly before integrating them into your cloud workflows.
- 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
- 2. Create your templates: Open WPS Writer or Spreadsheet to design the documents you intend to feature in your Power Apps gallery.
- 3. Save in standard formats: Save your documents as DOCX or XLSX files and upload them to your SharePoint or OneDrive to be used in your automated email flows.

Frequently Asked Questions
Can I send an email directly from Power Apps without using Power Automate?
Yes, you can use the Office365Outlook.SendEmailV2 function directly within Power Apps. However, attaching files straight from a gallery via this method is often limited to specific data types (like camera captures or pen inputs) and requires complex Base64 encoding. Power Automate is the standard method for retrieving physical files from cloud storage.
Why is my email attachment empty or corrupted when sent via the flow?
This typically occurs if the 'Get file content' action in Power Automate fails to fetch the actual binary data, or if the 'Attachments Content' field in the email action is mapped to the file name instead of the file content. Double-check your dynamic content mappings in the flow.
How do I email multiple selected files from a Power Apps gallery at once?
To send multiple files, you must add the selected gallery items into a collection in Power Apps. Then, format the collection as a JSON array and pass that JSON string to Power Automate. Inside the flow, use the 'Parse JSON' action and loop through the array to retrieve each file's content and append it to an array variable before sending the email.




