template2text - Create Text / HTML from Template and Data

Creates any text from template and given data. For example, dynamically generate HTML templates with data and logic, making it useful for building dynamic web applications. Based on Handlebars - see https://handlebarsjs.com/ for more details.
This function generates text or HTML by combining a template with provided data. It can be used to create dynamic web applications by using logic to generate HTML templates with data.

Handlebars provides a powerful way to generate dynamic content on the client or server-side. The template2text function makes it easy to use Handlebars to generate text or HTML with data, opening up many possibilities for dynamic web applications.

Example Templates

Using Handlebars to insert data into a template

Using the each helper to iterate over an array in a template

Using a conditional statement to show different content based on data

The function is based on Handlebars, a popular templating language for JavaScript.https://handlebarsjs.com

template
Type
string
Required
required
Template to be filled in with data. For expressions you can use the following syntaxes: {{ name }} and { { name } }. See handlebars documentation.
Example:
"{{#each peopleData}}<div class='person'><h2>{{name}}</h2><p><strong>Age:</strong> {{age}}</p><p><strong>Occupation:</strong> {{occupation}}</p><p><strong>Email:</strong> {{email}}</p></div>{{/each}}"
data
Type
object
Data used to fill the template.
Example:
{
  "peopleData": [
    {
      "name": "John Smith",
      "age": 32,
      "occupation": "Software Engineer",
      "email": "john.smith@example.com"
    },
    {
      "name": "Jane Doe",
      "age": 27,
      "occupation": "Marketing Manager",
      "email": "jane.doe@example.com"
    }
  ]
}
dataString
Type
string
Stringified Data used to fill the template.
Example:
{"peopleData":[{"name":"John Smith","age":32,"occupation":"Software Engineer","email":"john.smith@example.com"},{"name":"Jane Doe","age":27,"occupation":"Marketing Manager","email":"jane.doe@example.com"}]}
noEscape
Type
boolean
Set to true to not HTML escape any content.
preventIndentation
Type
boolean
By default, an indented partial-call causes the output of the whole partial being indented by the same amount. This can lead to unexpected behavior when the partial writes pre-tags. Setting this option to true will disable the auto-indent feature.
Example:

Available on

Postman
Make
Zapier
N8N
Airtable
SeaTable
Bubble
Power Automate
Workato
SAP Build