ML with circles

Mearns Learns

Setup PowerBI to refresh from a OneDrive folder

See the tip Setup PowerBI to refresh from OneDrive for details of setting a connection to a single file.

To set-up a connection to a OneDrive folder

Create the report in PowerBI

On the Home menu select Get Data - SharePoint folder

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

Enter the base Url for the OneDrive site.

It has the format of **https://YourDestinationTenantDomain-my.sharepoint.com/personal/**YourUserName_ YourO365Domain/

Click on the OK button.

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

A list of files will be displayed. Click on the Transform button.

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

In the Formula bar change the SharePoint.File to SharePoint.Contents

Drill-down on Table in the Content column where the Name column is Documents.

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

Continue drilling down on Table in the Content column where the Name column contains the sub-folder name, until you reach the sub-folder that you want to consolidate.

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

With the sub-folder open and the files that you want to consolidate displayed click on the Combine Files icon in the Content column header.

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

Choose the worksheet holding the data that you to consolidate.

Click on the OK button.

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

Preview data will be returned. Add any further steps required to transform the data. Click on Close & Apply

Setup PowerBI to refresh from a OneDrive folder Setup PowerBI to refresh from a OneDrive folder

Sample Code:

let
Source = SharePoint.Contents("https://cloud-my.sharepoint.com/personal/rob/",[ApiVersion = 15]),
Documents = Source{[Name="Documents"]}[Content],
#"Hyp view" = Documents{[Name="Hyp view"]}[Content],
#"Max" = #"Hyp view"{[Name="Max"]}[Content],
#"Data" = Max{[Name="Data"]}[Content],
#"Data - Values" = Data{[Name="Data - Values"]}[Content],
#"Filtered Rows" = Table.SelectRows(#"Data - Values", each [Extension] = ".xlsx"),