encode base64 url with powerquery RRS feed

  • Question

  • I would like to encode/decode a string using  Base64 format (encode url). is there a native solution in powerquery?
    Friday, May 27, 2016 2:57 PM


  • Check the code below:
    To encode, use Uri.EscapeDataString ("Encodes special characters in the input data according to the rules of RFC 3986.").
    For decoding, it is a bit harder. I have not found any bespoke function, so I leveraged the Uri.Parts function, which breaks down a Uri into records. You need to provide a dummy Url to make it work, then use Record.Field to isolate the desired part.
        Source = "this is a & @string to encode and decode !?",
        Encoded = Uri.EscapeDataString(Source),
        #"Decoded again" = Record.Field(Record.Field(Uri.Parts("" & Encoded),"Query"),"A")
        #"Decoded again"

    Wednesday, June 1, 2016 7:47 AM