# Cast a Table Column

### 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.

<details>

<summary><code>cast the table's "column-name" column to "data-type"</code></summary>

#### 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"
```

</details>

<details>

<summary><code>the blank value is x</code></summary>

#### 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
```

</details>

### 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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/automation-areas/tables-v2/get-a-column/cast-a-table-column.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
