# Clean and Format Data

Source: https://www.digiparser.com/docs/guides/post-processing/data-transformations

Post Processing

# Clean and Format Data

Use Ask AI or Custom Code to clean and format extracted values

Copy MarkdownOpen

# [Clean and Format Data](#clean-and-format-data)

Feedback

Use **Custom Code** in Post Processing when extracted values need a different format before they are exported. You do not need to write the code yourself--**Ask AI to Write Code** can create it from a plain-language instruction.

Feedback

There is no separate transformations menu. Formatting is handled through **Custom Code**.

## [Common changes](#common-changes)

Feedback

*   **Format dates** - Convert dates to a standard format (e.g. YYYY-MM-DD)
*   **Clean numbers** - Remove currency symbols, commas, and convert text to numbers
*   **Trim text** - Remove extra spaces from text fields
*   **Standardize values** - Convert text to uppercase, lowercase, or title case

## [Use Ask AI](#use-ask-ai)

Feedback

1.  Go to **Settings -> Post Processing**.
2.  Open **Custom Code**.
3.  Click **Ask AI to Write Code**.
4.  Describe the result you want and include the exact field names.
5.  Select a processed document and click **Run Code**.
6.  Compare the input and output, then click **Save Code** when it looks correct.

Feedback

For example:

```
Convert Invoice Date to YYYY-MM-DD and remove currency symbols and commas from Total.
```

## [Common transformations](#common-transformations)

### [Format dates](#format-dates)

Feedback

Convert dates from various formats to a standard format:

Feedback

*   "November 8, 2024" -> "2024-11-08"
*   "12/31/2024" -> "2024-12-31"

### [Clean amounts](#clean-amounts)

Feedback

Remove currency symbols and convert to numbers:

Feedback

*   "$1,234.56" -> 1234.56
*   "EUR 500" -> 500

### [Standardize text](#standardize-text)

Feedback

*   Convert to uppercase: "vendor name" -> "VENDOR NAME"
*   Convert to title case: "vendor name" -> "Vendor Name"
*   Trim spaces: " Vendor Name " -> "Vendor Name"

## [Tips](#tips)

Feedback

*   **Name the fields clearly** - Tell AI exactly which fields to change.
*   **Test on a real document** - Confirm the result before saving.
*   **Keep the structure** - Change values inside existing fields; do not add or remove schema fields.
*   **Use Lookups for reference data** - Use a lookup when the task is matching a value to a CSV list.

## [Next steps](#next-steps)

Feedback

*   [Custom Code](/docs/guides/post-processing/custom-code) - Test and save transformation code
*   [Lookups](/docs/guides/post-processing/lookup-tables) - Match and enrich with CSV files or parser data

How is this guide?

GoodBad

[

Overview

Transform and clean your extracted data

](/docs/guides/post-processing/overview)[

Lookups

Match and enrich extracted data with CSV files or parser data

](/docs/guides/post-processing/lookup-tables)