If you use Microsoft Power Apps for your internal tools, your data is probably stored in Microsoft SharePoint. Many people want to view SharePoint files right inside a Power Apps canvas app, making it easier to access documents.
In this post, I’ll show you how to connect Power Apps to a SharePoint document library. You’ll learn how to set up the connection and display files in your app so users can access documents without leaving it.
Let’s quickly dive in and view the steps to achieve that.
Add a SharePoint Connection to a Canvas App
Open your Canvas App in Microsoft Power Apps.
On the left panel, navigate to Data and click Add data.
Search for SharePoint, select the SharePoint connector, and authenticate if prompted.

Connect to a SharePoint Site
After selecting the SharePoint connector.
Choose Connect directly, type your SharePoint site URL (e.g., https://yourtenant.sharepoint.com/sites/yoursite) and click Connect.

Choose a List That Has Documents Stored in it.
From the available lists:
Select the Document Library where your files are stored, i.e. “Document-Viewer”, and click Connect.

Insert a Vertical Gallery
To display the documents, you will add the gallery component.
To do so, go to Insert and choose Vertical gallery.

Set the Data Source for the Gallery
Select the Gallery, then set your connected SharePoint document library as the data source.

Add a PDF Viewer
To enable preview documents, go to Insert – Media – PDF Viewer (experimental).
Place it next to or below the Gallery.

Select the PDF Viewer and set its Document property to:
Substitute(
Gallery1.Selected.Thumbnail.Large,
"/thumbnail",
"/pdf"
)

Test the code
To verify that your configuration is working, click the Play button, select different files in the Gallery on the left, and verify that the input is loading in the PDF viewer on the right.

Summary
This guide shows you how to connect Power Apps to SharePoint. You will learn how to display documents in a gallery and use a PDF Viewer to preview files.
