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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DebbieE
Community Champion
Community Champion

Change Data Source from Local Desktop to Sharepoint (Folder only because I select files later)

I have spent a lot of time sorting out the data source (Folder) and making sure it doesnt add helper files because I want to go to the folder and select multiple files with the same structure

 

then bring them through with the file name

 

This is the start of the code

 

let
Source = Folder.Files("C:\Users\MyName\Company\Project\Dummy Data"),

#"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Name], "Project")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Content", "Name"}),

 

However, its the local folder and not the Sharepoint folder.

What I really want to do it change it to the Sharepoint folder structure as easily as possible

 

I had a look at another forum post but this was connecting to the actual file not just the folder. I tried this

 

Source = Folder.Files("https://Company.sharepoint.com/sites/Project/Shared Documents/General/Dummy Data/"),

 

But get the error The supplied folder path must be a valid absolute path.

 

Is there an easy way I can move this from the Local folder to the Sharepoint folder and then continue with all the other M code Steps I have to

Filter to the files required

bring through the data (without creating Helper Queries including the file name

1 ACCEPTED SOLUTION
DebbieE
Community Champion
Community Champion

I have sorted it

 

Source = SharePoint.Files("https://Company.sharepoint.com/sites/Project/", [ApiVersion = 15]),

//Filter to the correct folder
#"Filtered Rows2" = Table.SelectRows(Source, each Text.Contains([Folder Path], "Dummy Data")),

//Filter to the correct files
#"Filtered Rows" = Table.SelectRows(#"Filtered Rows2", each Text.Contains([Name], "Project")),

#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Content", "Name"}),

 

and then you can continue on with the code

View solution in original post

1 REPLY 1
DebbieE
Community Champion
Community Champion

I have sorted it

 

Source = SharePoint.Files("https://Company.sharepoint.com/sites/Project/", [ApiVersion = 15]),

//Filter to the correct folder
#"Filtered Rows2" = Table.SelectRows(Source, each Text.Contains([Folder Path], "Dummy Data")),

//Filter to the correct files
#"Filtered Rows" = Table.SelectRows(#"Filtered Rows2", each Text.Contains([Name], "Project")),

#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Content", "Name"}),

 

and then you can continue on with the code

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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