Forum Discussion
Connecting PowerBi to a Sharepoint folder
- 9 months ago
Kareem385 , I think with the change in the connector, it starts using the root folder. We tried to filter like "/sub folder/"
- 9 months ago
Hi Kareem385
Power BI’s SharePoint Folder connector returns all files in the site recursively.
For large document libraries, this can be hundreds of thousands of rows, making it hard to find your target path.
Filtering after import doesn’t prevent the initial large metadata load, so performance is poor.
#Workarounds
1️⃣ Connect via Folder Path + Relative Path
Instead of connecting to the root site, connect to the specific folder/library URL.
Example:
https://company.sharepoint.com/sites/SiteName/Shared Documents/TargetFolderIn Power BI Desktop → Get Data → SharePoint Folder → Paste full folder URL
Power BI will now return only files in that folder (not entire site).
---
2️⃣ Use SharePoint Document Library Connector
If you are connecting via SharePoint Folder, try Get Data → SharePoint Online List / SharePoint Document Library.
Choose the specific library instead of the entire site.
You can then filter on the folder column to limit results before loading.
---
3️⃣ Filter Using Folder Path in Power Query
If you must connect to the root, filter early in Power Query:
= Table.SelectRows(Source, each Text.StartsWith([Folder Path], "https://company.sharepoint.com/sites/SiteName/Shared Documents/TargetFolder/"))This prevents loading all rows into memory.
Always filter before expanding content (don’t expand binary columns until after filtering).
---
4️⃣ Use SharePoint Search / API for large libraries
For very large libraries, Power BI may struggle.
Option: Use SharePoint REST API to retrieve a specific folder’s files.
Example endpoint:
https://company.sharepoint.com/sites/SiteName/_api/web/GetFolderByServerRelativeUrl('/sites/SiteName/Shared Documents/TargetFolder')/FilesConnect via Power Query → Web → OData/JSON
This returns only the files in your target folder, bypassing the huge library.
---
5️⃣ Optimize performance
Avoid expanding File Content until needed.
Avoid connecting to the root site if possible.
Only load metadata columns (Name, Path, Modified) for initial filtering.
I wanted to add to my previous question. Is there a way to connect a Sharepoint Folder (just the subfolder) to Power BI?
- amitchandak9 months ago
Super User
Kareem385 , I think with the change in the connector, it starts using the root folder. We tried to filter like "/sub folder/"