GoogleSheets
Snippet for displaying data from the table
Parameters for the snippet:
Name | Description |
---|---|
spreadsheetId | ID of the spreadsheet. |
range | Sheet name of the spreadsheet, can also include a cell range for selection (Mylist!A1:J10) |
ignoreHeaders | Skip the first row in the table. Possible values: 1 or 0 |
keys | Variable names, separated by commas. |
where | Condition for filtering results. |
sortby | Sorting field. Default: id |
sortdir | Sorting direction. Default: asc |
limit | Limit on the selection. Default: 0 |
tpl | Chunk for displaying results. If not specified, an array of results will be displayed. |
Example
php
<table class="table">
<tbody>
{'!GoogleSheets' | snippet: [
'spreadsheetId' => '16eyRFL94Dtqm8QQjYzw6gsY2iMIO5Ij30lBXVIpKGbw',
'range' => 'FormItForm',
'ignoreHeaders' => 1,
'keys' => 'id,form,ip,date,name,email',
'where' => ['form' => 'Brevo'],
'sortby' => 'date',
'sortdir' => 'desc',
'limit' => 5,
'tpl' => 'formList'
]}
</tbody>
</table>
Chunk formList
html
<tr>
<td>[[+id]]</td>
<td>[[+form]]</td>
<td>[[+ip]]</td>
<td>[[+date]]</td>
<td>[[+name]]</td>
<td>[[+email]]</td>
</tr>
keys
You can skip certain values if they are not needed. For example, if you specify id,form,ip,,,email, then date and name will not be displayed.
php
<table class="table">
<tbody>
{'!GoogleSheets' | snippet: [
'spreadsheetId' => '16eyRFL94Dtqm8QQjYzw6gsY2iMIO5Ij30lBXVIpKGbw',
'range' => 'FormItForm',
'ignoreHeaders' => 1,
'keys' => 'id,form,ip,,,email',
'where' => ['form' => 'Brevo'],
'sortby' => 'date',
'sortdir' => 'desc',
'limit' => 5,
'tpl' => 'formList'
]}
</tbody>
</table>
Error
However, if you specify id,form,ip,email, the field email will display the date (from the field date).