OBJECTS_TO_MARKDOWN_TABLE

Converts an array of objects into a markdown-formatted table string. Headers are optional; if none are provided, the keys of the first object are used. Pipe characters in values are escaped automatically.

Syntax 

OBJECTS_TO_MARKDOWN_TABLE(objects, headers)

Usage examples 

Example 1

Input

1
{
2
"my_action": {
3
"objects": [
4
{
5
"name": "John Smith",
6
"age": 45,
7
"city": "Melbourne"
8
},
9
{
10
"name": "Jane Doe",
11
"age": 32,
12
"city": "Sydney"
13
},
14
{
15
"name": "Bob Jones",
16
"age": 27,
17
"city": "Brisbane"
18
}
19
]
20
}
21
}

Formula

OBJECTS_TO_MARKDOWN_TABLE(my_action.objects)

Output

"| name | age | city |\n| --- | --- | --- |\n| John Smith | 45 | Melbourne |\n| Jane Doe | 32 | Sydney |\n| Bob Jones | 27 | Brisbane |"

Example 2

Input

1
{
2
"my_action": {
3
"objects": [
4
{
5
"name": "John Smith",
6
"age": 45,
7
"city": "Melbourne"
8
},
9
{
10
"name": "Jane Doe",
11
"age": 32,
12
"city": "Sydney"
13
},
14
{
15
"name": "Bob Jones",
16
"age": 27,
17
"city": "Brisbane"
18
}
19
]
20
}
21
}

Formula

OBJECTS_TO_MARKDOWN_TABLE(my_action.objects, ["name", "city"])

Output

"| name | city |\n| --- | --- |\n| John Smith | Melbourne |\n| Jane Doe | Sydney |\n| Bob Jones | Brisbane |"
Was this helpful?