Power Apps Upload File to SharePoint Document Library

Have you ever uploaded any file to SharePoint Document Library using Power Apps? If not, no worries!

This Power Apps tutorial will assist you with how to work with Power Apps Upload File to SharePoint Document Library with various examples.

Power Apps Upload File to SharePoint Document Library

In this scenario, a user will upload an attachment by using the Power Apps attachment control, and then the user will press the button.

When the button is pressed, the specific file will upload to the SharePoint Library folder (TSInfo Documents).

To workaround with this, you can refer to the instructions below:

1. Create a SharePoint Document Library and a folder to add an attachment. Refer to the screenshot below.

2. My SharePoint library is called Documents (internally, SharedDocuments), and the folder I made here is called TSInfo Documents. The Power Apps file will be uploaded to this folder.

Power Apps Upload File to SharePoint Document Library

3. Next, Sign into Power Apps and create a blank canvas app with a tablet or mobile layout. Add an Attachment control and a Button control on the Power Apps screen, as shown below.

NOTE:

Check out this complete tutorial to learn how to add and use Power Apps Attachment control.
upload attachment to sharepoint list powerapps

4. Now, we will create a flow in Power Apps. Go to the Power Automate tab [from left navigation] -> Create new flow -> Click on + Create a flow as shown below.

powerapps upload attachment to sharepoint list

5. The below Power Automate page will appear where the flow will start triggering in Power Apps (V2). Just rename the flow name as Power Apps Upload File.

powerapps add attachment to sharepoint list

6. Next, click the + New step button and add a Create file action (in SharePoint). Enter the field values as like below:

FieldsDescription
Site AddressSelect or enter the SharePoint site address where the Document library is present.
Folder PathSelect the Document Library name and the folder name where you want to upload the Power Apps attachment.
File NameTo specify the file’s name, click the Dynamic content -> Select Ask in PowerApps option. Power Apps will then directly take the file name from itself.
File ContentTo specify the file content, select the Dynamic content -> Select Ask in PowerApps option. It will directly take the file content from the Power Apps itself.

There is nothing else to do in the flow. When finished, save the flow and return to the Power Apps app.

powerapps attach file to sharepoint list

7. On the Power Apps screen, click on the Upload Button -> Go to the Power Automate tab [from left navigation] -> Add flow -> Select Power Apps Upload File that you created recently.

8. Once the flow is added to the upload button, then the below code will appear automatically in the Button’s OnSelect property as:

OnSelect = PowerAppsUploadFile.Run(

Where,

PowerAppsUploadFile = Flow name

9. Next, specify the Attachment File name (.Name) and the File content (.Value) in the code. So below is the proper code that I have used on Button’s OnSelect property:

OnSelect = PowerAppsUploadFile.Run(
    First(DataCardValue3_1.Attachments).Name,
    First(DataCardValue3_1.Attachments).Value
);

Where,

DataCardValue3_1 = PowerApps Attachment Control name

powerapps upload file to sharepoint list

10. Save and Preview (F5) the app once everything is done. Attach a file using the Attach file option and then press the Upload button.

add files in SharePoint library using flow

11. When you click the upload button, the file will be added to the SharePoint Document Library folder. You can see that the flow has succeeded by looking at the Flow run history, as indicated below.

powerapps upload file to sharepoint

12. Go to the SharePoint Document Library (Documents) and open the existing folder (TSInfo Documents). Refresh the library; the file you need has been uploaded to the folder, as in the screenshot below. You can then open the file from the library itself.

add powerapps files in SharePoint library using flow

This way, we can upload attachments to the SharePoint list using Power Apps.

Conclusion

From this Power Apps tutorial, I hope you learned how to upload an attachment to the SharePoint list using Power Apps.

Also, you may like some Power Apps tutorials: