Binary.FromText is a Power Query M function that converts a text value to a binary value using the specified encoding (Base64 or Hex). The function returns a binary representation of the text value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Binary.FromText(
text as nullable text,
optional encoding as nullable number,
) as nullable binary
Description
Returns the result of converting text value text
to a binary (list of number
). encoding
may be specified to indicate the encoding used in the text value.
The following BinaryEncoding
values may be used for encoding
.
BinaryEncoding.Base64
: Base 64 encodingBinaryEncoding.Hex
: Hex encoding
Examples
Decode “1011” into binary.
// Output: Binary.FromText( "1011", BinaryEncoding.Base64 )
Binary.FromText( "1011" )
Decode “1011” into binary with Hex encoding.
// Output: Binary.FromText( "EBE=", BinaryEncoding.Base64 )
Binary.FromText( "1011", BinaryEncoding.Hex )
Related functions
Other functions related to Binary.FromText are:
