Text.Start
TextReturns a text value of the specified length from the start of a text value.
Syntax
Text.Start(text as nullable text, count as number) as nullable textParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | text | Yes | The source text value. |
count | number | Yes | The number of characters to return from the start of the text. |
Return Value
text — The first count characters of text.
Remarks
Text.Start extracts a substring from the beginning of a text value, returning the first count characters. It is the left-side counterpart to Text.End, and together they cover the most common fixed-length extraction patterns from the edges of a string.
If text is null, the function returns null. If count is greater than the length of text, the entire text is returned without error — there is no out-of-bounds exception. If count is 0, an empty string "" is returned.
Use Text.Start when the prefix has a known, fixed length. When the prefix is delimited by a separator character at a variable position, use Text.BeforeDelimiter instead — it is more robust when the delimiter position changes across rows. For extracting from the middle of a string, use Text.Middle or Text.Range.
Text.Start(text, n) is exactly equivalent to Text.Range(text, 0, n) and Text.Middle(text, 0, n), but Text.Start expresses intent more clearly when extracting a prefix.
Examples
Example 2: Extract the year from a hire date stored as text
Text.Start("2021-03-15", 4)Result | |
|---|---|
| 1 | 2021 |
Example 3: Truncate long department names to a maximum length
Table.TransformColumns(
#table({"Department"}, {{"Sales"}, {"Engineering"}, {"Marketing"}}),
{{"Department", each Text.Start(_, 7), type text}}
)Department | |
|---|---|
| 1 | Sales |
| 2 | Enginee |
| 3 | Marketi |