Shape · Columns

Format to Text

Turns a number, date or time column into formatted text: thousands separators, fixed decimals, currency or a date pattern. The pattern can come from another column, row by row. Unlike Format Table, this changes the data.

Also known as: Number to text, format as text

How it works

Click Add rule, pick the Column and choose How. Format takes the same options as Format Table and prints a value that does not fit the format as its plain text. Pattern takes one DuckDB pattern: printf for numbers, such as %,.2f for 1,234.57, or strftime for dates and times, such as %d/%m/%Y. Per row reads each row's own pattern from the Pattern column. Read the pattern as is By type by default, or Number or Date/time when you want to force the language. A blank pattern gives the plain text, a null gives null, and a pattern that cannot render a value fails the run. Output column blank replaces the column in place; the result is text either way.

Inputs and outputs

Inputs

  • data — Table

Outputs

  • data — Table

Settings

The Attributes panel of Format to Text, as in the app: the controls work, but nothing runs — there is no data behind it.

The same settings, as the Assistant writes them
rules: [{ column: string, outputColumn?: string, mode: "format"|"pattern"|"patternColumn", format?: { type?: "number"|"currency"|"percent"|"date"|"text", decimals?: number, separator?: "comma"|"dot"|"space"|"none", currencyCode?: string, negative?: "minus"|"parens", mask?: string }, pattern?: string, patternColumn?: string, kind?: "auto"|"number"|"datetime" }]  // the result is text. mode "format" takes the same format spec as Format Table. mode "pattern" takes a DuckDB printf / strftime pattern: printf for numbers, e.g. "%,.2f" gives 1,234,567.89, strftime for dates and times, e.g. "%d/%m/%Y"; a blank pattern gives the plain text. mode "patternColumn" reads each row's pattern from patternColumn. kind picks printf or strftime (default "auto": by the column type). A blank outputColumn replaces the column in place.

Example

An invoice file needs amount as 1,234.57 and issued as 05/03/2026, exactly as text. Add a Pattern rule on amount with %,.2f and one on issued with %d/%m/%Y, leaving both output columns blank.