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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
hcze
Helper II
Helper II

Dynamic Data Source

Hi,

 

I am using an Excel file stored on Sharepoint site and I would like to keep the folder dynamic.

It currently hits an error during data refresh on Power BI Service.

 

Here is my code:

strFolder = TblFolder{0}[Data Folder],
Source = Excel.Workbook(Web.Contents(strFolder & "Alibaba.xlsm"), null, true),

 

Appreciate your help.

 

hcze

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@hcze 
You can create a query parameter with foldernames. Then apply the parameter to code, make the str folder = the parameter name (Folder Name in the example). Something like:

 

strFolder = TblFolder{0}[Folder Name]

Source = Excel.Workbook(Web.Contents(strFolder & "Alibaba.xlsm"), null, true),

 

Vpazhenmsft_1-1632986496742.png

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@hcze 
You can create a query parameter with foldernames. Then apply the parameter to code, make the str folder = the parameter name (Folder Name in the example). Something like:

 

strFolder = TblFolder{0}[Folder Name]

Source = Excel.Workbook(Web.Contents(strFolder & "Alibaba.xlsm"), null, true),

 

Vpazhenmsft_1-1632986496742.png

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors