How to add a file to a SharePoint document library in Power Apps?

Visit Our Power Apps Page

If you’re looking for more information about Power Apps and related topics, take a look there. There you will find all articles about Power Apps in one place.

or continue reading…


In Power Apps, adding a file as an attachment to the list is very easy. However, when we want to put a file in a SharePoint document library – there is a problem. PowerApps does not yet have a ready component for editing the content of a SharePoint document library.

The situation is similar with copying files. Power Apps does not have ready-made mechanisms – you should use Power Automate, which has ready-made solutions. As it turns out, they are not without flaws. Fortunately, there is an alternative.

The following articles will discuss methods that use standard Power Automate mechanisms and the alternative – SharePoint REST API

Standard mechanisms
Power Automate

  • Get attachments
  • Get attachment content
  • Create file
  • Copy file
  • Get file content
  • Create file

Power Automate and
SharePoint REST API

  • Send an HTTP request to SharePoint

We will also check the speed comparison of both solutions


Adding a file as an attachment to a SharePoint list and copying to the library

Adding an attachment to a SharePoint list item

In Power Apps, adding a file directly to the list is only possible using forms. So we create a form in the application with the field for adding an attachment.

Power Apps Form with Attachments Example

After placing the form on the screen and connecting it to the data source, you only need to remember to add the Attachments field and insert a button and link an action to it

SubmitForm( Form )

Saving the form will create a row in the SharePoint list with the file as an attachment. The Power Apps form allows you to attach several files.

The examples presented below take into account such a scenario.

Copy an attachment from the list to the document library

The next step is to create a Power Automate that will transfer our file to the SharePoint document library. This task is performed by a simple Power Automate flow that is run from the OnSuccess function of the form

  • In the ListItemID variable I will remember the ID of the line from which I want to download attachments
  • Download all attachments from the list item
  • Download all attachments from the list item
  • For each of the attachments
    • download its content
    • create a file based on its name and contents