Text.TrimEnd

Text

Removes trailing whitespace (or specified characters) from a text value.

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

Syntax

Text.TrimEnd(text as nullable text, optional trim as any) as nullable text

Parameters

NameTypeRequiredDescription
texttextYesThe text value to trim from the end.
trimanyNoA single character or list of characters to trim from the end. Defaults to whitespace.

Return Value

textThe text with trailing whitespace or specified characters removed.

Remarks

Text.TrimEnd removes characters from the end of a text value only. By default it removes whitespace, but you can pass a character or list of characters to trim instead.

Examples

Example 1: Trim trailing characters

Table.AddColumn(
    Table.SelectColumns(Table.FirstN(Customers, 3), {"Email"}),
    "Trimmed", each Text.TrimEnd([Email]), type text
)
Result
Email
Trimmed
1alice@example.comalice@example.com
2bob@example.combob@example.com
3charlie@example.comcharlie@example.com

Compatibility

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