// n8n integration

Parse Localized Number

This operation is available on both n8n Cloud and self-hosted n8n and requires the CustomJS community package. It ships with the next release of the @custom-js/n8n-nodes-pdf-toolkit-v2 package, available from version 0.12.0. See Installation.

The Parse Localized Number operation converts number strings from invoices, CSV exports, scraped websites, and user input into real numbers. Formats that break a plain parseFloat are handled correctly:

  • European format: "1.234,56 EUR" becomes 1234.56
  • US format: "$1,234.56" becomes 1234.56
  • Accounting negatives: "(500)" becomes -500
  • Swiss apostrophes: "1'234.56" becomes 1234.56
  • Currency symbols and spaces are stripped automatically, including non-breaking spaces

By default the format is detected automatically. If your data source is known to be European or US formatted, you can pin the format to avoid ambiguity (e.g. "1.234" could be one thousand two hundred thirty four in EU format, or 1.234 in US format).

Where to find it

The operation lives in the CustomJS (PDF & File Toolkit) node:

  1. Add the PDF Toolkit node to your workflow
  2. Set Resource to Data
  3. Set Operation to Parse Localized Number

Configuration

Node Parameters

ParameterDescriptionRequired
ValueThe localized number text to parse, e.g. "1.234,56 EUR" or "$1,234.56"Yes
Number FormatAuto Detect, EU (1.234,56), or US (1,234.56)No (default: Auto Detect)

Example

Input:

Value: "1.234,56 EUR"
Number Format: Auto Detect

Output:

{
  "number": 1234.56,
  "rounded": 1234.56,
  "isNegative": false,
  "detectedFormat": "decimal comma (eu)",
  "originalText": "1.234,56 EUR"
}

Output Fields

FieldDescription
numberThe parsed number, full precision
roundedThe number rounded to 2 decimal places, handy for currency values
isNegativetrue for negative values, including accounting style "(500)"
detectedFormatWhich format was detected or applied, useful for debugging
originalTextThe original input text, unchanged

If no digits can be found in the input, the node throws a clear error so you can catch it with n8n's error handling.