Hello,
I'd like direction on how best to dynamically set the file path component of a Power Query source data connection so that it is used within the actual query. My goal is to be able to use an SSIS ForEach File Enumerator to pass in the file path and have the Power Query source use that path within the M query. I'd also like to be able to use another SSIS variable from the enumerator to set the file name value so I know what file I'm parsing. However, I'm not clear on the syntax within the M query. How would I substitute the File.Contents path & FileName column values below with variable values? I can set the Power Query Connection Manager Datasource Path via the Expression editor, but it doesn't seem to affect the query itself.
Thanks in advance!
Note: query below is a simplified version of actual file processing.
let Source = Table.FromColumns({Lines.FromBinary(File.Contents("\\network\path\filename.txt"), null, null, 1252)}), #"Added Custom" = Table.AddColumn(Source, "FileName", each "FileNameFromVariable"), #"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"FileName", "Column1"}), #"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Column1", "FileLine"}}) in #"Renamed Columns"