Skip to main content

Creating an HTML table from a Celonis Query Data output

Use this solution to transform row-by-row Celonis query outputs into aggregated HTML tables. The documentation covers two methods: the Text Aggregator for date formatting and the Table Aggregator for high-column scalability. Both methods conclude with an Email module that wraps the aggregated data in a standard HTML <table> structure.

This section illustrates two primary methods for converting Celonis Query Data into a professional email report. Both workflows follow a three-stage logic: Extraction, Aggregation, and Delivery.

Including Text Aggregator (supports dates)

This approach is best when you need to apply custom logic or formatting to specific data fields during the aggregation process.

Including Table Aggregator (easily scalable for columns)

This approach is optimized for speed and simplicity when dealing with large datasets or high column counts.

  1. Data Extraction: The flow begins by pulling row-level data (e.g., Order IDs and Delivery Dates) from the Celonis Query Data module.

  2. Custom Formatting: The Text Aggregator is used to wrap each data point in HTML tags (<tr> and <td>). This method allows for the use of PQL or Action Flow functions, such as formatDate, to convert raw timestamps into readable formats (e.g., DD.MM.YYYY).

  3. Consolidation: Individual rows are concatenated into a single text string, preparing the payload for the final HTML structure.

Example of Creating an HTML table and sending it using Mail snippet with three modules: Celonis, Tools, Email.
  1. Automated Mapping: Instead of manual tag wrapping, the Table Aggregator allows you to select multiple "Aggregated Items" simultaneously.

  2. Structural Definition: You define the table structure using the Column Separator (set to <td>;) and Row Separator (set to <tr><td>). This automatically generates the necessary HTML syntax for every row processed from the Celonis output.

  3. Sends an email to defined recipients with the html table built with the text aggregator and inside the content field.

55706473.png

Below you will find the step-by-step guide for configuring each module of the above Action Flow.

To get the data you want to use in the HTML Table, you must set up the Celonis Query Data Model. All information on how to do it can be found here. We use some Demo Data here, for example, getting Order IDs and the corresponding delivery dates.

55706492.png

Configuration:

Action Flows Module: Celonis

Action: Query Data

55706523.png
2.1 Text Aggregator (dealing with dates)2.1 Table Aggregator (easily scalable for columns)

The Celonis Query Data Model outputs the data row by row, so to use that data for an HTML table, we have to aggregate it. We use the Text aggregator to concatenate the data.

55706520.png

Configuration:

Action Flows Module: Tools

Action: Text Aggregator

The screenshot below shows how this module has been configured with our demo data.

57541883.png

To build up an HTML table, you have to define a structure with table rows (<tr>) and table cells (<td>) which will later be included in a table structure to get the right format. Here you have the chance to format dates as we show them with the Delivery Dates.

Add for each column you want to have in your resulting table the structure <td> data of the column </td>

Text:

<tr>

<td>{{1.`Order ID`}}</td>

<td> {{formatDate(1.`Delivery Date`; "DD.MM.YYYY")}}</td>

</tr>

The Celonis Query Data Model outputs the data row by row, so to use that data for an HTML table, we have to aggregate it. We use the Table aggregator to concatenate the data.

55706521.png

Configuration:

Action Flows Module: Tools

Action: Table Aggregator

The screenshots below show how this module has been configured with our demo data.

55706530.png
55706705.png

Choose all columns you want to include in your HTML table in the 'Aggregated Items' section.

Column Separator:Other

Separator: <td>

Row Separator:Other

Separator: <tr> <td>

Note

The output of the Table aggregator is the same as if we use the Text aggregator, so it is concatenated Text including HTML tags but not an HTML table yet. The table will be built using that text in the Email module in the next step.

We use the Send an Email module to wrap the constructed HTML code in a table and send it via mail.

55706522.png

Configuration:

Action Flows Module: Email

Action: Send an Email

The screenshot on the right shows how this module has been configured with our demo data.

To: You can choose a recipient of your choice

Subject: Define the subject of the mail

Content Type: HTML

Content: here, we will build the table. The content section is divided into the styling HTML code and the HTML code building up the table.

In the styling HTML code, you can change:

  • the heading of the mail (text in between the <h2> tags)

  • text you want to add in the mail (text in between the <p>tags).

In the table HTML code you have to:

  • add the 'text' item of the Table/Text aggregator at the right place (as shown in the screenshot) to make the table look right.

  • adapt the table headers to your needs (see info box below)

HTML code:

<html>
<head>
<style> table, th, td {border: 1px solid black;border-collapse: collapse;} </style>
</head>
<body>
<h2> Delivery Dates </h2>
<p> See below the upcoming Delivery Dates.</p>
<table style="width:100%">
<tr>
<th>Order ID</th>
<th>Delivery Date</th>
</tr>
{{2.text}}
</table>
</body>
</html>

Table Header

The tag <th> stands for a table header, so you need to replace the Text marked in red with the table headers you would like to have in the table/columns. IMPORTANT: you have to put them in the same order you used in the Table/Text Aggregator to ensure the right table header is in the right column.

Spaces

Be careful with using spaces between or after the tags, which can cause problems like adding empty columns or rows. New lines shouldn't cause problems.

57542292.png

HTML Table Styling

If you want to customize the HTML Table but haven't got experience with HTML, you can use this website to style a table in a visual editor, which provides you with the HTML code. You can adjust or replace different snippet tags to style your table.

Related topics