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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
McSarah
Helper I
Helper I

Formula.Firewall - failed dynamic Excel connection when using list parameters in connection string.

Hi guys, I've searched and found many threads that seem closely related to my issue, but none exactly addressed my problem. This actually seems simpler than most of the problems I've found, so hopefully many people know what I should do.

 

I am trying to build a dynamic connection string to an excel workbook in PowerQuery, where the file name in the connection string is supplied with a parameter: 

 

Source = Excel.Workbook(File.Contents("<MyFolderPath>" & Param1), null, true)

 

This works great if the parameter passes a hard coded string value, but fails as soon as I change it to use a Query/ List as the source. Then, I get this standard error message:

 

Formula.Firewall: Query 'Query1' (step 'Table') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

 

This problem occurs even when the parameterized query contains nothing but the data connector and the excel sheet selector. I've stripped the M down to the simplest possible code; this is the entire thing:

 

let
      Source = Excel.Workbook(File.Contents("<MyFolderPath>" & Param1), null, true),
      Table = Source{[Item="DataSource",Kind="Sheet"]}[Data]
in
      Table

 

For this reason, solutions like the one in this excellent blog post (https://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/) don't seem to apply; I'm only pulling a single data source so there can't be any permissions conflict, and I'm not doing any tranformations that might present challenges for query folding. The data source Permissions setting for all my data sources for this workbook is set to "Public", so even if there were more than one data sourcein this code, permissions conflict shouldn't be the source of this problem.

 

Here is my complete data flow to create the list I use as the source for the file name parameter.

let
      Source = Folder.Files("<MyFolderPath>"),
      #"Removed Columns" = Table.RemoveColumns(Source,{"Content", "Extension", "Date accessed", "Date modified", "Attributes", "Date created"}),
     #"Filtered Rows" = Table.SelectRows(#"Removed Columns", each Text.StartsWith([Name], "<stuff i need to filter on>")),
     List = #"Filtered Rows"[Name]
in
     List

 

Next, I go to Manage Parameters and configure my parameter to use Suggested Values: "Query" and Query: "List" (to get the list resulting from the code above). Then I use the parameter in my connection string as above. That's it.

 

I can't think of anything else to check besides the things I've done -- radically simplifying the initial query, checking the permissions. What have I missed?

 

 

 

1 REPLY 1
v-alq-msft
Community Support
Community Support

Hi, @McSarah 

 

I'd like to suggest you try to modify the privay level as 'Ignore the Privacy Levels and potentially improve performance'(File=>Options=>CurrentFile=>Privacy). Or you may combine all your codes in one query to see if it works.

 

For further information, please refer to the similar thread .

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.