Download function
Applies to: Canvas apps Model-driven apps
Downloads a file from the web to the local device.
Description
The Download function downloads a file from the web to the local device.
In native players (Windows, Android, and iOS), the user is prompted for a location to save the file.
When used on the web, Download is dependent on the browser's settings to determine what happens with the file. For images, videos, PDFs, and other file types that the browser natively supports, a new browser tab is opened to display the file. Many browsers support saving the contents to the local file system.
Only on Windows, Download returns the location where the file was stored locally as a text string.
Download can only be used in behavior formulas.
Syntax
Download( Address )
- Address – Required. The URL address of a web resource to download.
Note
Power Apps cannot authenticate download requests to the address provided in the Download() function.
For example, when using this function to download a file stored on a SharePoint site that requires authentication, the request might work when using a web browser since the browser session might authenticate against the SharePoint site using cached credentials. However, in Power Apps mobile app, the request will not work since authenticating the download request is not handled by the mobile device.
Examples
Simple Download
The following formula will download the user's guide for the Surface Book, a PDF file:
Download( "https://go.microsoft.com/fwlink/?linkid=827480" )
When run in a mobile device, the user will be prompted for a location to save the file.
When run in most web browsers, a new tab will be opened to display the PDF file as most browsers natively support this file type.
Step by Step
The Product Showcase tablet layout template was used for the following example. To create an app with this template, follow the steps from create an app article and select the Product Showcase template. You can also use your own app.
Go to Power Apps.
Select Apps from left navigation pane.
Select your app and then select Edit.
Select Insert from the menu and then select Label.
Move the label to the bottom right of the screen.
From the properties pane on the right-side, select Color as white and set Border thickness at 1.
Select the Text property from right-side and enter text as Download User Guide.
From property list on top left, select OnSelect.
Enter formula as
Download("https://go.microsoft.com/fwlink/?linkid=827480")
. You can also use any other URL of your choice.Save and publish the app.
Play the app.
Select the Download User Guide button to download the guide.
Note
Your browser settings determine whether to download the file or open the file directly in a new tab. For more details, go to Download function description.