Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I'm an expeirenced Power BI user so first time trying to use Fabric to build a new model
I just wanted ot check if i'm being stupid or its by design. I want to connect to a sharepoint subfolder
In power query I use this as the source (slightly edited)
= Excel.Workbook(Web.Contents("https://consolidatedhealthltd.sharepoint.com/sites/PowerBIReporting/Shared%20Documents/Trinity%20Bud..."), null, true)
This goes directly to the folder or file required
If Fabric I created a data flow and found the all I could put in the url was https://consolidatedhealthltd.sharepoint.com which then listed every sinlge file in the Sharepoint (thousands). Once it had finished creating I can filter down to the folder i need, but seems incredible waste of resources? i tried ot specify tighter and it just failed.
Is there no way to specify the actual folder or file PowerBIReporting/Shared Documents/Trinity Budget/Budget Input FY25 May24.xlsx???
Thanks for any advice
Mike
Solved! Go to Solution.
Hi @masplin , thank you for reaching out to the Microsoft Fabric Community Forum.
You are correct, skipping the last file entry in the M code would allow you to run a function on the entire folder rather than targeting a specific file. And yes it is much faster than pointing to the root SharePoint site and filtering down thousands of files, especially when dealing with large repositories.
Please try below:
let
Source = SharePoint.Contents("https://consolidatedhealthltd.sharepoint.com/sites/PowerBIReporting"),
Folder = Source{[Name="Shared Documents"]}[Content],
Subfolder = Folder{[Name="Trinity Budget"]}[Content]
in
Subfolder
let
Source = SharePoint.Contents("https://consolidatedhealthltd.sharepoint.com/sites/PowerBIReporting"),
Folder = Source{[Name="Shared Documents"]}[Content],
Subfolder = Folder{[Name="Trinity Budget"]}[Content],
Files = Table.SelectRows(Subfolder, each Text.EndsWith([Name], ".xlsx")),
Content = Table.AddColumn(Files, "Data", each Excel.Workbook([Content], null, true)),
ExpandedData = Table.ExpandTableColumn(Content, "Data", {"Name", "Data"})
in
ExpandedData
If this helps, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details.
Thank you.
t's great thanks very much
Hi @theferret , thank you for reaching out to the Microsoft Fabric Community Forum.
Fabric's Dataflows Gen2 currently operates differently from Power Query in terms of SharePoint connections, but there are ways to make the process more efficient.
Please Consider below:
Source = SharePoint.Contents("https://consolidatedhealthltd.sharepoint.com/sites/PowerBIReporting"),
Folder = Source{[Name="Shared Documents"]}[Content],
Subfolder = Folder{[Name="Trinity Budget"]}[Content],
File = Subfolder{[Name="Budget Input FY25 May24.xlsx"]}[Content],
Excel = Excel.Workbook(File, null, true)
in
Excel
If this helps, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details.
Thank you.
Presumably If I wanted to run a function on a whole folder just skip the last file entry?
I assume this is much faster than pointing the site and then filtering down the folders to the one you require if the site contains alot of folders and files?
Thanks very much for the advice
Hi @masplin , thank you for reaching out to the Microsoft Fabric Community Forum.
You are correct, skipping the last file entry in the M code would allow you to run a function on the entire folder rather than targeting a specific file. And yes it is much faster than pointing to the root SharePoint site and filtering down thousands of files, especially when dealing with large repositories.
Please try below:
let
Source = SharePoint.Contents("https://consolidatedhealthltd.sharepoint.com/sites/PowerBIReporting"),
Folder = Source{[Name="Shared Documents"]}[Content],
Subfolder = Folder{[Name="Trinity Budget"]}[Content]
in
Subfolder
let
Source = SharePoint.Contents("https://consolidatedhealthltd.sharepoint.com/sites/PowerBIReporting"),
Folder = Source{[Name="Shared Documents"]}[Content],
Subfolder = Folder{[Name="Trinity Budget"]}[Content],
Files = Table.SelectRows(Subfolder, each Text.EndsWith([Name], ".xlsx")),
Content = Table.AddColumn(Files, "Data", each Excel.Workbook([Content], null, true)),
ExpandedData = Table.ExpandTableColumn(Content, "Data", {"Name", "Data"})
in
ExpandedData
If this helps, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details.
Thank you.
I still have a problem using sub folders, I get this error:
Expression.Error: The key didn't match any rows in the table.
Hi @alloowishus , Thank you for reaching out to the Microsoft Community Forum.
This is because you’ve switched to SharePoint.Files instead of SharePoint.Contents that I suggested. SharePoint.Files returns a flat list of all files, so there’s no Shared Documents row to drill into, hence the key didn’t match any rows error.
If you want to navigate through subfolders the way you’re doing, stick with SharePoint.Contents and drill down step by step. Also, make sure each step continues from the previous one, your Subfolder3 is currently jumping back up a level. If you do want to use SharePoint.Files, then you’ll need to filter by [Folder Path] instead of navigating by name.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 9 | |
| 4 | |
| 4 | |
| 3 | |
| 3 |