Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ilyasss
Helper II
Helper II

Best practice to get access to a sharepoint folder

Hello guys, 

 

I hope you are well. 

 

I'm looking to retrieve some excel files from a sharepoint folder to combine them. 

 

I've started to use the function SharePoint.Files but it scans all the files on sharepoint before getting anything. There are hundreds thousands of files so it's too slow to use it. 

 

Do you know if there is a better way to get a direct access to the folder avoiding PBi to scan all the files on sharepoint ? 

 

Many thanks for your help, 

 

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

You can try to change Sharepoint.Files() to SharePoint.Contents() to see if that works better for you.  Or you can add a Filter step on the FolderPath before you start combining files.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hello @mahoneypat  and thank you. 

 

Using SharePoint.Contents() instead of Sharepoint.Files() seems to be a good idea. 

 

Nevertheless, when I try to open the folder I have this error : 

 

PBi forum 14-05.jpg

 

Do you know how to fix this ? 

 

Regards, 

 

Not sure.  That should work.  Remember that M is case sensitive.  Does your [Name =  <yourfoldername>] part match case too?

 

Here one tip to help troubleshoot.  Connect again and navigate where you see your folder and a hyperlink of "Table" next to it. Click to the right of the hyperlink (not on it) to preview the contents.  Is it empty (null)?  If so, put a file there and try again.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you @mahoneypat

 

It took me a lot of time to identify the issue. The error was caused because one of the folder name contained a special character, in this case it was "&". 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.