Forum Discussion

Kareem385's avatar
Kareem385
New Member
8 months ago
Solved

Connecting PowerBi to a Sharepoint folder

Hi all,

 

I am trying to connect a SharePoint folder to Power BI but am getting a lot of results back. The site I connect too has a very large quantity of documents and the specific path I'm looking for is unavailable. Is there a potential workaround to find paths within a site that has a lot of documents/files? Even filtering doesn't help in this situation. 

 

Any suggestions would be appreciated.

 

Thanks,
Kareem

  • Kareem385 , I think with the change in the connector, it starts using the root folder. We tried to filter like "/sub folder/" 

  • 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/TargetFolder

    In 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')/Files

    Connect 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.

6 Replies

  • 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/TargetFolder

    In 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')/Files

    Connect 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?

    • amitchandak's avatar
      amitchandak
      Icon for Super User rankSuper User

      Kareem385 , I think with the change in the connector, it starts using the root folder. We tried to filter like "/sub folder/" 

  • Hi Kareem385 ,

     

    When you connect to a location using sharepoint folder you are likely to get lot of files, as it shows all files in sharepoint . you can go to power query editor and apply filter on the path column to get exact filesyou want.

     

    alternatively, you can also try web connector of power bi to connect to your file as well.

    Please give kudos or mark it as solution once confirmed.

     

    Thanks and Regards,

    praful

  • v-hashadapu's avatar
    v-hashadapu
    Icon for Community Support rankCommunity Support

    Hi Kareem385 , Thank you for reaching out to the Microsoft Community Forum.

     

    We find the answer shared by Nabha-Ahmed  is appropriate. Can you please confirm if the solution worked for you. It will help others with similar issues find the answer easily.

     

    Thank you Nabha-Ahmed  for your valuable response.

  • v-hashadapu's avatar
    v-hashadapu
    Icon for Community Support rankCommunity Support

    Hi Kareem385 , Hope you're doing fine. Can you confirm if the problem is solved or still persists? Sharing your details will help others in the community.