Automation is essential for increasing productivity and simplifying work. Downloading files is one of these tasks, particularly when handling a lot of file downloads. The lack of native file download functionality in PowerApps makes it difficult to download files. In this blog post, we’ll go over how to use Power Automate to automate file downloads from PowerApps by converting sample data into an Excel sheet and downloading it to the local computer.
PowerApps Collection
- PowerApps collection can help us to store required data that the user wants to download as a file. Here are the steps to store them.
- Go to the On Visible property of the screen.
- Create a collection using the Collect() or Clear Collect() functions and assign the required data to the function and give it a name.
- Next, pass the data to the power automate flow by using the below function.
- Afterward, Use the following actions to convert the collection data into an excel file and store it into the SharePoint library.
-
Various parameters are generated once the create file action is run.
-
Out of which Etag is a parameter that contains the UniqueID related to the created file in SharePoint which looks like the one in the below picture.
- The string between the curly braces is the UniqueID that we have to capture.
- To capture the string, use Respond to a PowerApp action to send the Etag back to PowerApps.
8. In the flow run statement, you can observe that we have set the flow run output to a variable response, which will contain the eTag.
9. Split statement splits the string based on the provided parameter, in this case its “}” . So after splitting the etag, there will be 2 strings out of which we require the first string. So we use First function to capture that first string.
10.The second split statement now splits the obtained string again by considering “{: as a parameter and now we require the 2nd split string. So we use Last function to capture the unique ID string.
11. Now, assign the extracted unique ID to the below URL which is taken from the SharePoint site to a Download function and paste this function to a download icon.
12. Upon clicking the icon containing the above download function, the file will be successfully downloaded to your local machine.
13. In the end of the flow, we can add a team’s action to notify specific users within a group about the file download.
Pros:
- ETag (Entity Tag) provides a way to identify the specific version of a file. This ensures that the file being downloaded is the latest version or matches the user’s request.
- By using the ETag, the system avoids unnecessary file processing and data transfers, reducing server load and improving app responsiveness.
- Many cloud storage solutions (e.g., SharePoint, OneDrive) and REST APIs support ETags for file identification. Leveraging ETags aligns with these standards, making integration seamless.
Cons:
- PowerApps alone cannot directly handle ETags or complex HTTP headers. Integration with Power Automate or custom connectors is mandatory, which adds complexity to the solution.
- If the ETag mismatches (e.g., due to a file being updated during a request), users may receive errors or need to retry the download, which can cause confusion without proper error messages.
- The concept of ETags may not be directly visible to users. Without clear feedback or messaging, users might not understand why a download failed (e.g., due to a mismatched ETag).
Conclusion:
This method streamlines the process of automating file download through PowerApps not only for excel, but for various file types making it a versatile solution for PowerApps users instead of going with the manual download process.
Source: Read MoreÂ