TEXT

TEXT(value, formatting=None)[source]

Converts a field or value to its text representation with optional formatting.

This function mimics the behavior of Excel’s TEXT function. It converts value to a string, optionally applying a formatting pattern. Both singular values and arrays are supported. If any argument is blank or in an error state, the formula evaluates to an error.

Parameters:
  • value (Operand) – The value or field to convert to text.

  • formatting (Operand | str | None) – Optional. A string or field that specifies the text format to apply to value. If provided, must be a string or string array. Defaults to no formatting.

Return type:

Formula

Returns:

The text representation of value, optionally formatted. Returns an array if value or formatting is an array.

Raises:

ValueError – If formatting is not STRING or STRING_ARRAY.

Examples

Basic usage with literals:

TEXT(123)
# Returns "123"

Using formatting:

TEXT(0.75, "0.00%")
# Returns "75.00%"

With field references:

TEXT(customer["balance"], "$0.00")
# Returns formatted balance as text in dollar format

With array input:

TEXT([1, 2, 3], "00")
# Returns ["01", "02", "03"]

``value`` — accepted types

  • BOOLEAN

  • BOOLEAN_ARRAY

  • BOOLEAN_MAP

  • DATE

  • DATETIME

  • DATETIME_ARRAY

  • DATETIME_MAP

  • DATE_ARRAY

  • DATE_MAP

  • DECIMAL

  • DECIMAL_ARRAY

  • DECIMAL_MAP

  • INTEGER

  • INTEGER_ARRAY

  • INTEGER_MAP

  • NULL

  • OBJECT

  • OBJECT_ARRAY

  • STRING

  • STRING_ARRAY

  • STRING_MAP

  • TIME

  • TIME_ARRAY

  • TIME_MAP

``formatting`` (optional) — accepted types

  • STRING

  • STRING_ARRAY

Return types

  • STRING

  • STRING_ARRAY