Forum Discussion

Michiel's avatar
Michiel
Resolver III
8 years ago
Solved

Encode a Text field

I'm using an API requiring a token in Base64 encoding, coming from a text string.

Playing around with the query editor and M, I've been able to succesfully convert the encoded string back to the original with Binary.FromText function and the BinaryEcoding.Base64 constant. But is there a way to do the opposite, so encoding the original string into Base64 format?

7 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi Michiel,

     

    Try the formula below.

    Binary.ToText(Text.ToBinary([Column1]), 0)

    base64

     

    Best Regards,

    Dale

      • Jonas1's avatar
        Jonas1
        Helper I

        Hi Michiel ,

        Currentely sitting with the same issue as you did, gonna have to do a encode-decode to retrieve what will finally be my APi-token. Would you mind showing me your code on this?