Format Data

50+ data formatting operations for text, numbers, dates, JSON, and logic -- without writing code.

Overview

The Format Data action transforms, formats, and calculates data in your HubSpot workflows without writing code. Select an operation, map the input property, and the result is available for subsequent workflow steps.

With 50+ built-in operations across text, number, math, date, JSON, and logic categories, plus custom formula support, Format Data covers the vast majority of data transformation needs.

Setup

1

Add the action to your workflow

Search for "AuPerate: Format Data" in the HubSpot workflow editor.

2

Select an operation

Choose from the dropdown: uppercase, lowercase, number_format, date_format, add, and many more. Or select "custom" to write a formula.

3

Map the input and optional parameters

Map a HubSpot property to the input field. Some operations require a second input or parameter (e.g., the format pattern for dates, the number of decimal places).

Text Operations

OperationDescriptionInputResult
uppercaseConvert to uppercasehello worldHELLO WORLD
lowercaseConvert to lowercaseHello Worldhello world
capitalizeCapitalize first letter of each wordjohn smithJohn Smith
trimRemove leading/trailing whitespace hello hello
substringExtract part of string (start, length)hello (0, 3)hel
replaceReplace text (find, replace_with)hello (l, r)herro
lengthReturn string lengthhello5

Number Operations

OperationDescriptionInputResult
number_formatFormat with decimal places1234.5678 (2)1,234.57
currencyFormat as currency (symbol, decimals)1234.5 ($, 2)$1,234.50
percentageFormat as percentage0.456 (1)45.6%
roundRound to nearest integer3.74
floorRound down3.73
ceilRound up3.24
absAbsolute value-4242

Math Operations

Math operations use input1 and input2 as operands. Both must be numeric values (or HubSpot properties that resolve to numbers).

OperationDescriptionExampleResult
addAdd two numbers100 + 50150
subtractSubtract input2 from input1100 - 3070
multiplyMultiply two numbers25 * 4100
divideDivide input1 by input2100 / 333.33
Division by zero returns an error. Make sure input2 is never zero when using the divide operation.

Date Operations

OperationDescriptionExampleResult
date_formatFormat a date with a pattern2026-04-10 (MM/DD/YYYY)04/10/2026
date_addAdd time to a date (amount, unit)2026-04-10 (7, days)2026-04-17
date_subtractSubtract time from a date2026-04-10 (1, months)2026-03-10
date_diffDifference between two dates2026-01-01, 2026-04-10 (days)99
nowCurrent date and time(YYYY-MM-DD)2026-04-10

Date Format Tokens

TokenDescriptionExample
YYYYFour-digit year2026
MMTwo-digit month04
DDTwo-digit day10
HHHours (24-hour)14
mmMinutes30
ssSeconds45
AAM/PMPM

JSON Operations

OperationDescription
json_getExtract a value from a JSON string using a path
json_stringifyConvert a value to a JSON string
json_parseParse a JSON string and extract a field
Example: json_get
Input: {"user": {"name": "John", "age": 30}}
Path: user.name
Result: John

Logic Operations

OperationDescription
default_valueReturn input1 if it has a value, otherwise return input2 as the default
conditionalIf input1 is truthy, return input2; otherwise return input3
Example: default_value
Input1: ""        (empty HubSpot property)
Input2: "Unknown"
Result: "Unknown"
Example: conditional
Input1: "closedwon"   (lifecycle stage)
Input2: "Customer"
Input3: "Prospect"
Result: "Customer"    (because input1 is truthy)

Custom Formulas

Custom formulas let you combine multiple operations into a single expression. Set the operation tocustom and write your formula in the formula field.

Template Syntax

Reference HubSpot properties with {{property_name}} and mapped inputs with [[input1]], [[input2]], [[input3]].

Available Functions

concat()upper()lower()trim()capitalize()length()floor()ceil()abs()substring()replace()round()if()default()

Math Expressions

Standard math operators are supported: +, -, *, /

Nested Functions

Functions can be nested inside each other for complex transformations:

Example: Nested formula
upper(concat({{firstname}}, " ", {{lastname}}))

Step-by-step:

  1. 1. {{firstname}} resolves to john
  2. 2. {{lastname}} resolves to smith
  3. 3. concat() produces john smith
  4. 4. upper() produces JOHN SMITH

More Formula Examples

Calculate discounted price
round({{deal_amount}} * 0.85, 2)
// If deal_amount = 1000, result = 850.00
Conditional greeting
if({{firstname}}, concat("Hello, ", capitalize({{firstname}}), "!"), "Hello there!")
// If firstname = "john", result = "Hello, John!"
// If firstname = "", result = "Hello there!"
Default value with formatting
upper(default({{company}}, "Unknown Company"))
// If company = "acme", result = "ACME"
// If company = "", result = "UNKNOWN COMPANY"
Complex calculation with text
concat(
  capitalize({{firstname}}),
  " - ",
  if({{deal_amount}} > 10000, "Enterprise", "SMB"),
  " ($",
  round({{deal_amount}}, 0),
  ")"
)
// firstname = "john", deal_amount = 25000
// Result: "John - Enterprise ($25000)"

Output Fields

FieldTypeDescription
optihub_successBooleantrue if the operation completed without errors
resultStringThe formatted/transformed output as a string
result_numberNumberThe result as a number (if applicable, e.g., math or number operations)
optihub_errorStringError message if the operation failed, empty if successful

Next: Hash and Encrypt

Learn how to hash, encrypt, and encode data in workflows.

Continue