Table
Table or in the previous version known as Data columns
is used to store scraped data from a website. Table is similar to a spreadsheet. But in the table, every column is a strict type of data.
Add Column
Open a workflow, and click the table icon () on the top right. Input the name of the column, and click the add button. Next to the column you have added, you can select the data type of the column.
There're four data types you can select Text
, Number
, Boolean
, and Array
Insert Data
If a block has the "Insert to table" checkbox when you edit it, it means the block can insert data into the table. You can find this checkbox in a block like the get text block and attribute value block.
The data that the block scraped, later on, will be inserted in the column that you selected. The data that gets inserted into the table is getting push to the end row of the column. For example, when using the get text block and the name
column is selected, before the block is executed:
name | price | url |
---|---|---|
Car | 4000 | https://en.wikipedia.org/wiki/Car |
Motorcycle | 2000 | https://en.wikipedia.org/wiki/Motorcycle |
After the block is executed:
name | price | url |
---|---|---|
Car | 4000 | https://en.wikipedia.org/wiki/Car |
Motorcycle | 2000 | https://en.wikipedia.org/wiki/Motorcycle |
Boat |
And if you don't want the data to be inserted into the table, you can uncheck the "Insert to table" checkbox.
Accessing Table Data
To access the row of table from an input of a block, you can use a mustache tag like {{ table }}
, and the mustache tag will be replaced with all the data from the table.
To get specific row or column of the table, you can write a mustache tag with {{ table@path }}
syntax, the path
is where you write the dot notation of the data. For example, the table inside a workflow is stored as an array of objects like these:
[
{ "name": "Car", "price": 4000, "url": "https://en.wikipedia.org/wiki/Car" },
{ "name": "Motorcycle", "price": 2000, "url": "https://en.wikipedia.org/wiki/Motorcycle" }
]
To get the first row or index of the table.
syntax:{{ table@0 }}
output:{ "name": "Car", "price": 4000, "url": "https://en.wikipedia.org/wiki/Car" }
Get the second row of the table.
syntax:{{ table@1 }}
output:{ "name": "Motorcycle", "price": 2000, "url": "https://en.wikipedia.org/wiki/Motorcycle" }
Get the
name
column from the first row.
syntax:{{ table@0.name }}
output:Car
Get the
price
column from the second row.
syntax:{{ table@1.price }}
output:2000
Get Table Last Row
To get the last row of the table, use the $last
property inside the mustache tag. For example, {{ table@$last.column }}
replace column
with any column that you want.