none
How call environment variables with Power Query? RRS feed

  • Question

  • Hello,

    I need to use an environment variable to run the same code on different computers,
    I declare a variable on each computer, but I do not know how I call.
    In the  macro (VBA)  I use  Environ ()
    as it is called in Power Query?

    Thanks,

    Luisg

    Thursday, November 3, 2016 11:09 AM

Answers

  • Hello,
    In the  macro (VBA)  I use  Environ ()
    as it is called in Power Query?

    Thanks,

    Luisg

    Hi Luis,

    As what is called in Power Query? There is no Environ or equivalent function in Power Query, although I've often wished that such a function existed (along with other settings available through VBA).

    Thursday, November 3, 2016 9:19 PM

All replies

  • Hello,
    In the  macro (VBA)  I use  Environ ()
    as it is called in Power Query?

    Thanks,

    Luisg

    Hi Luis,

    As what is called in Power Query? There is no Environ or equivalent function in Power Query, although I've often wished that such a function existed (along with other settings available through VBA).

    Thursday, November 3, 2016 9:19 PM
  • Hi Luis. As Colin said, there's currently no way to access environment variables from within Power Query. However, I'd encourage you to add this to the Power BI Ideas site (or vote it up if it's already there).

    Ehren

    Friday, November 4, 2016 7:34 PM
    Owner
  • Thank's , I'm a little disappointed, and you are sure I'll add this in Power BI site Ideas.
    Luisg
    Saturday, November 5, 2016 2:14 PM
  • One approach is to put the below formula in the current workbook.  It will update automatically on workbook load without the user having to enable macros, i.e. so no need to use VBA.

    =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1)

    Thursday, November 24, 2016 1:40 PM
  • One approach is to put the below formula in the current workbook.  It will update automatically on workbook load without the user having to enable macros, i.e. so no need to use VBA.

    =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1)

    Hi Simon,

    I might be missing something, but what does your formula have to do with the VBA Environ() function, which can be used to return about 50 Windows environment variables? Also, it's not clear to me what question was asked that your formula solves.

    Regards,

    Colin

    Thursday, November 24, 2016 5:08 PM