Forum Discussion
vertokite
3 years agoFrequent Visitor
Using Windows environment variable in a PowerBI desktop parameter
Hello I'm trying to use the windows environment variable %USERNAME% as part of a parameter to define source setting. The source data line in the editor looks like this: source = Excel.Wo...
ArtiSt
3 years agoNew Member
You may try somthing like
let
re=(string,regex,flags)=>Web.Page(
"<script>
document.write(('"&string&"').match('"®ex&"','"&flags&"'));
</script>")[Data]{0}[Children]{0}[Children]{1}[Text]{0}
in
re(Text.Combine(Folder.Contents("C:\Users")[Name], ","),"p\\d{6}", "g")
With RegEX you may filter the part of the path from the CSV generated by Text.Combine
see: RegEx in Power BI and Power Query in Excel with Java Script – (thebiccountant.com)