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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
WillBeeSEA
Helper III
Helper III

Trying to use %USERNAME% or %USERPROFILE% in path of source files

I would like to use  %USERNAME% or %USERPROFILE% in the Data source settings, such as the image below.  This way, users can put the source files in their own Documents folder no matter who they are.

WillBeeSEA_1-1753297830975.png

WillBeeSEA_2-1753298035498.png

It seems to accept it when I entered that and clicked OK, but when I click "Apply Changes" it reports the error "File or folder: Could not find a part of the path."

----------

I also tried %USERPROFILE% to eliminate the need for "C:\Users\"

WillBeeSEA_3-1753298157558.png

... but that time, all I did was enter it and click OK, and it immediately reported: "We didn't find any data sources in this file."

 

Any ideas?  Thank you.

 

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

Hello, @WillBeeSEA ,

Power Query cannot access environment variables. And there is no built in function to do so either. Perhaps with python inside Power Query, you can do that.

 

However, why do you actually want to even do this? As this is very bad design. Why can't you put the file on shared place like a sharepoint folder or, if you really need this, perhaps create folder in C:\ directly, so everyone can have the same path. 

In general using local path to access files is not the best idea + you can't really easily refresh it on PBI Service either.

View solution in original post

2 REPLIES 2
vojtechsima
Super User
Super User

Hello, @WillBeeSEA ,

Power Query cannot access environment variables. And there is no built in function to do so either. Perhaps with python inside Power Query, you can do that.

 

However, why do you actually want to even do this? As this is very bad design. Why can't you put the file on shared place like a sharepoint folder or, if you really need this, perhaps create folder in C:\ directly, so everyone can have the same path. 

In general using local path to access files is not the best idea + you can't really easily refresh it on PBI Service either.

Hi vojtechsima, 

Thank you for the information about the PQE not being able to access environment variables. and yes, it is not the best approach.  I like your other options better.

Will

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors