typespowerquery

What is the Binary data type in Power Query used for?


I'm working with Power Query in Microsoft Excel and noticed one of the available data types in the "Transform" tab was the Binary type. I checked Microsoft's documentation on the data type, but the description was unhelpfully vague:

The Binary data type can be used to represent any other data with a binary format.

I initially thought this referred to binary numbers, (eg: 0s and 1s). However, when I tried converting a column of 0s and 1s to the Binary type I got the error "Invalid binary encoding".

What type of data is the Binary type in Power Query meant for?


Solution

  • Edit: TLDR "binary" is not the same as "Boolean".

    In Power Query, the Binary data type is used to represent raw binary data. This includes any content stored in a binary format, such as:

    The sentence "The Binary data type can be used to represent any other data with a binary format" may be misleading or too vague. A more accurate description would be:

    "The Binary data type in Power Query is designed to handle raw binary content, typically used for representing files or data streams that are not inherently textual or tabular."

    For example, when importing files from a folder into Power Query such as a collection of JPG images each file is automatically represented as a Binary object. This allows Power Query to process, transform, or pass the data to other steps in the query pipeline, such as decoding, converting to text, or extracting metadata.

    enter image description here