Forum Discussion

kna_mekoprint's avatar
kna_mekoprint
Copper Contributor
Dec 12, 2023

[Power Query] Using Windows environment variable to seek for folder

Hello,
I've done office sript for several people for reporting 3D printing. I've managed to make excel to look for latest "*.gcode" file in temp folder and then extract content into table (via power query). And then with office script it does formatting.
The problem is that when other user executes script, the file path in power query is constant. I would like to make it variable as it is in windows (%TEMP%). Typing %TEMP% does not work. 
I'm not not very familiar of power query also office scripts.
I've searched for solution in other posts, but the source file name in each post is constant, mine is not. I cannot change the path for seeking for file, it must be %TEMP%.

1 Reply

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    Hi kna_mekoprint 

     

    Unfortunately you can't get an Environment variable via Power Query. Same goes with Excel functions, VBA is required

     

    I quickly searched but didn't find info. saying this would be doable with Office Script (double-check in case I missed it)

     

    Obviously doable with Power Automate:

Resources