While working with the SharePoint Online document library, we sometimes need to upload a file or multiple files from Power Apps to the SharePoint document library.
In this Power Apps tutorial, I will explore in detail information about upload files from Power Apps to the SharePoint document library including:
- Power Apps upload file to SharePoint document library using flow
- Power Apps upload multiple files to SharePoint
- Power Apps upload file to SharePoint document library without flow
Power Apps Upload File to SharePoint Document Library
Recently, I got the opportunity to work with Power Apps upload files to the SharePoint document library using different real-time scenarios.
I have created a SharePoint document library named “Policy Documents,” which has the fields below.
Column Name | Data Type |
Name | It is a default single line of text |
Modified | Date and time |
Modified By | Person or Group |
Review Date | Date and time |
Is Approved | Yes/NO |

Now, I would like to upload or add a file from Power Apps to the SharePoint document library. Unfortunately, there is no direct way to upload a file or files to the document library from Power Apps.
But there is a way to overcome this issue, like connecting the Power Automate Instant flow to the Power Apps and uploading files using a single button click from Power Apps to the SharePoint document library.
NOTE:
As of the last update in January 2022, uploading files to a SharePoint document library directly from Power Apps without using Power Automate is not directly supported.
However, we can directly upload the files from Power Apps to the SharePoint list without using any flows.
Have a look at the below screenshot for the output.

To achieve it, follow the below steps. Such as:
1. On the Power Apps Screen, insert an Edit form control and set its DataSource to any existing SharePoint list for the “Attachment control.”
DataSource = 'Company Attachments'
Where,
- ‘Company Attachments’ = SharePoint Online list

2. Now cut the Attachment control, paste it outside the form, and delete the form. You can see some errors will appear in the Attachment control. To resolve those errors, follow the below properties.
DisplayMode = DisplayMode.Edit
Items = Blank()
Max attachments = 1

3. Now, the Attachment control is ready to attach any file. Once you click on the Attach file link from the attachment control, it will redirect you to your local system to select the files.

4. Documents or files cannot be uploaded directly to a SharePoint document library from Power Apps; instead, a Power Automate flow must be created for this purpose.
5. For that, go to the Power Automate section, select the Create new flow button, and click on the + Create from blank button, as shown below.

6. Once you click on the “Create from blank” button, the trigger will be created as PowerApps (V2) by default. Then, you can choose the user input as a File.

7. Next, click on the + New step to add an action [Create a file] and provide the below information. Such as:
- Site Address = Provide the specific SharePoint site address URL
- Folder Path = Select the SharePoint document library where you are going to upload the Power Apps files
- File Name = The File Name field requires a Expression -> [triggerBody()[‘file’][‘name’]
- File Content = The File Content field should reference the file located within our flow trigger

8. Once it is done, Rename and Save the flow. You will now find the created flow under the Power Automate section, as shown below.

9. Finally, insert a Button control and set its OnSelect property to the code below.
OnSelect = PowerAppsUploadFileToSharePointDocumentLibrary.Run(
{
File: {
name: First(Attach_File.Attachments).Name,
contentBytes: First(Attach_File.Attachments).Value
}
}
);
Where,
- PowerAppsUploadFileToSharePointDocumentLibrary = Power Automate flow name
- name = It stores the filename and extension
- Attach_File = Power Apps Attachment control
- contentBytes = This contentBytes field holds a reference to the attachment file

10. Once your app is ready, Save, publish, and Preview the app. When the user uploads any file or document from the local device and clicks on the button control, the flow will trigger successfully, as shown below.

11. Also, the file will stored in the SharePoint Online document library as well.
This way, you can upload a single file from Power Apps to the SharePoint document library.

Power Apps Upload Multiple Files to SharePoint
Similarly, if you want to upload multiple files from Power Apps to the SharePoint document library, you can follow the code below to set the button control’s OnSelect property.
OnSelect = ForAll(
Attach_File.Attachments As Document,
PowerAppsUploadFileToSharePointDocumentLibrary.Run(
{
File: {
contentBytes: First(Attach_File.Attachments).Value,
name: First(Attach_File.Attachments).Name
}
}
)
)
Note:
If you want to upload multiple files from Power Apps to SharePoint library, you should increase the Max attachments from 1 to another value.

Save, Publish, and Preview the app. Whenever the user selects multiple files from a local device and clicks on the button control, the flow will trigger successfully, and files will be stored in the document library.

This is how we can work with Power Apps upload multiple files to the SharePoint library.
How to Add Metadata to the SharePoint Document Library
Suppose you want to upload the file, including the metadata from Power Apps, to the SharePoint document library; follow the below steps. Such as:
1. On the Power Apps Screen -> Insert an Edit form above the Attachment control and set its DataSource as:
DataSource = 'Policy Documents'
Where,
- ‘Policy Documents’ = SharePoint document library

2. Now, edit the current flow, like adding Text input for File Properties -> Add Compose action and setting Its Inputs as a SharePoint online site, as shown below.

3. Next, add another action [Update file properties] and provide the below information. Such as:
- Site Address = Provide site address from Compose outputs
- Library Name = By default, it will take library code based on the outputs
- ID = You can Seect dynamic content of ItemID
- Item = For Item property, you can use the following expression like, (json[triggerBody()[‘text’]) using File Properties

4. After saving the flow, insert a Submit icon on the Power Apps Screen and set its OnSelect property to the code below.
OnSelect = PowerAppsUploadFileToSharePointDocumentLibrary.Run(
JSON(
frm_Records.Updates,
JSONFormat.IncludeBinaryData
),
{
file: {
name: First(Attach_File.Attachments).Name,
contentBytes: First(Attach_File.Attachments).Value
}
}
)
Where,
- JSON() = We can use this Power Apps JSON() function to add metadata to the SharePoint document library

5. Save, Publish, and Preview the app. Once the user adds metadata, including the attachment, and clicks on the save icon, the flow will trigger successfully, and you will get the attachment file, including metadata, on the SharePoint library.

I trust this Power Apps tutorial will be helpful. If you have any requirements related to uploading a Power Apps file to the SharePoint document library, you can follow the above examples to do it.
Also, you may like:
- Power Apps Update Data Table
- Create Power Apps Popup Message
- Power Apps Set Text input Value Based On Another Field
- Power Apps Value Function
- 6 Easiest Ways to Filter Gallery in Power Apps
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com