Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a table on Excel user interface that contains folders / parameters / variables. This query:
let
#"Source from Table Range" = Excel.CurrentWorkbook(){[Name="ParameterTable"]}[Content],
Path = Folder.Files(#"Source from Table Range"{0}[Path])
in
Pathreturns something like
C:\Users\okgo\Company123\SharePointSite\Folder1
Which I then refernce in sample files and other queries as the source
Can I elgantly use the same table and adjust the M in advanced editor to leverage the SharePoint connector?
http://Company123.sharepoint.com/SharePointSite/Folder1
Solved! Go to Solution.
Hello
Yes, just add a new column in the Exceltable called Typ. Input Folder or Sharepoint. In M-language you can refer now to this new column with an if-statement like if [Type] = "Folder" then Folder.Files... else Sharepoint....
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Thank you @Jimmy801 - that makes sense for the Excel table UI
Using Sharepoint.Contents I can navigate to the correct folder. However that creates many steps which would be annoying (or non value adding) to feedback into the Excel UI. Maybe I will just live with the hardcoding as it does solve the problem of not being user specific which is an improvement to C:\
let
Source = SharePoint.Contents("https://company123.sharepoint.com/SharePointSite/", [ApiVersion = 15]),
Project1 = Source{[Name="Project1"]}[Content],
Folder2 = Project1 [Name="_Study_Specific"]}[Content],
Customer3= Folder2 {[Name="Customer3"]}[Content],
Account4 = Customer3{[Name="Account4"]}[Content],
in
Account4
Hello
Yes, just add a new column in the Exceltable called Typ. Input Folder or Sharepoint. In M-language you can refer now to this new column with an if-statement like if [Type] = "Folder" then Folder.Files... else Sharepoint....
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Thank you @Jimmy801 - that makes sense for the Excel table UI
Using Sharepoint.Contents I can navigate to the correct folder. However that creates many steps which would be annoying (or non value adding) to feedback into the Excel UI. Maybe I will just live with the hardcoding as it does solve the problem of not being user specific which is an improvement to C:\
let
Source = SharePoint.Contents("https://company123.sharepoint.com/SharePointSite/", [ApiVersion = 15]),
Project1 = Source{[Name="Project1"]}[Content],
Folder2 = Project1 [Name="_Study_Specific"]}[Content],
Customer3= Folder2 {[Name="Customer3"]}[Content],
Account4 = Customer3{[Name="Account4"]}[Content],
in
Account4
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 17 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |