Lines.FromBinary

Lines

Splits binary content into a list of text lines.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Lines.FromBinary(binary as binary, optional quoteStyle as nullable number, optional includeLineSeparators as nullable logical, optional encoding as nullable number) as list

Parameters

NameTypeRequiredDescription
binarybinaryYesThe binary content to split into lines.
quoteStylenumberNoHow quoted line breaks are handled: QuoteStyle.None (default) or QuoteStyle.Csv.
includeLineSeparatorslogicalNoWhen true, line separator characters are included at the end of each line.
encodingnumberNoThe text encoding (e.g., TextEncoding.Utf8).

Return Value

listA list of text values, one per line.

Remarks

Lines.FromBinary converts binary content into a list of text lines by splitting on line-break characters (CR, LF, or CRLF). This is useful for reading text files line-by-line without using Csv.Document.

When quoteStyle is set to QuoteStyle.Csv, line breaks inside quoted fields are not treated as line separators — this is important when processing CSV files that contain multi-line cell values.

A common pattern is to combine this with File.Contents to read a plain text or log file:

``powerquery Lines.FromBinary(File.Contents("C:\Logs\app.log")) ``

Examples

Example 1: Split binary text into lines

let
    Source = Binary.From("Line 1#(lf)Line 2#(lf)Line 3"),
    Lines = Lines.FromBinary(Source),
    AsTable = #table({"LineNumber", "Text"}, List.Transform({0..List.Count(Lines)-1}, each {_ + 1, Lines{_}}))
in
    AsTable
Result
LineNumber
Text
11Line 1
22Line 2
33Line 3

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks