Lines.FromBinary
LinesSplits binary content into a list of text lines.
Syntax
Lines.FromBinary(binary as binary, optional quoteStyle as nullable number, optional includeLineSeparators as nullable logical, optional encoding as nullable number) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
binary | binary | Yes | The binary content to split into lines. |
quoteStyle | number | No | How quoted line breaks are handled: QuoteStyle.None (default) or QuoteStyle.Csv. |
includeLineSeparators | logical | No | When true, line separator characters are included at the end of each line. |
encoding | number | No | The text encoding (e.g., TextEncoding.Utf8). |
Return Value
list — A 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
AsTableResult
LineNumber | Text | |
|---|---|---|
| 1 | 1 | Line 1 |
| 2 | 2 | Line 2 |
| 3 | 3 | Line 3 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks