Lines.FromText
LinesSplits a text value into a list of lines.
Syntax
Lines.FromText(text as text, optional quoteStyle as nullable number, optional includeLineSeparators as nullable logical) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | text | Yes | The text value 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. |
Return Value
list — A list of text values, one per line.
Remarks
Lines.FromText splits a text value into a list of lines by breaking on line-feed characters (CR, LF, or CRLF). It is the text-input counterpart to Lines.FromBinary.
This is simpler than Text.Split(text, "#(lf)") because it handles all common line-ending styles automatically (Windows CRLF, Unix LF, and legacy Mac CR).
Examples
Example 1: Split multi-line text
let
Source = "Alice#(lf)Bob#(lf)Charlie#(lf)Diana",
Lines = Lines.FromText(Source),
AsTable = #table({"Index", "Line"}, List.Transform({0..List.Count(Lines)-1}, each {_ + 1, Lines{_}}))
in
AsTableResult
Index | Line | |
|---|---|---|
| 1 | 1 | Alice |
| 2 | 2 | Bob |
| 3 | 3 | Charlie |
| 4 | 4 | Diana |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks