Cast a Table Column

Converts a table column to a specified data type.

Overview

This procedure casts a specified column in a table to a given data type. It supports conversion to common data types including text, decimals, and integers. For numeric conversions, it automatically handles comma-separated values and provides options for handling blank values.

Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

cast the table's "column-name" column to "data-type"

What does it do?

Converts the specified column to the target data type.

Where does it go?

This phrase should be written on a new line.

Is it required?

✅ Yes — This phrase is required.

Does it require data?

✅ Yes — Replace column-name with the name of the column to convert. Replace data-type with the target data type: "string" (text), "float" (decimals), or "int" (integers).

Example

cast the table's "Age" column to "float"
the blank value is x

What does it do?

Specifies a replacement value for empty cells, null values, or NaN entries when converting to numeric types (float/int). This is useful when your data contains missing values that need to be handled during conversion.

Where does it go?

Indented under cast the table's "column-name" column to "data-type".

Is it required?

❌ No — This phrase is optional.

Does it require data?

✅ Yes — Replace x with the desired replacement value for missing data. For instance, you can use 0 for integer columns or 0.0 for decimal columns.

Example

the blank value is 0

Examples

1. Cast Integer Column to Float (Decimal)

cast the table's "Amt" column to "float"

2. Cast Numeric Column to String (Text)

cast the table's "Max" column to "string"

3. Cast Column to Integer with Blank Value

In this example, the "Price" column contains some missing or empty values. When converting to integer, these blank entries are replaced with 0.

cast the table's "Price" column to "int"
    the blank value is 0

4. Cast Column to Float with Custom Blank Value

When converting a column with missing values to decimal format, a custom replacement value of 0.0 is used for empty cells.

cast the table's "Amount" column to "float"
    the blank value is 0.0

Last updated

Was this helpful?