2020-03-28 11:08:39 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2020-03-15 16:51:31 -07:00
2021-12-03 00:44:16 -08:00
export const tableOperations : INodeProperties [ ] = [
2020-03-15 16:51:31 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-03-15 16:51:31 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
options : [
{
name : 'Add Row' ,
value : 'addRow' ,
2020-10-22 06:46:03 -07:00
description : 'Adds rows to the end of the table' ,
2022-07-10 13:50:51 -07:00
action : 'Add a row' ,
2020-03-15 16:51:31 -07:00
} ,
{
name : 'Get Columns' ,
value : 'getColumns' ,
description : 'Retrieve a list of tablecolumns' ,
2022-07-10 13:50:51 -07:00
action : 'Get columns' ,
2020-03-15 16:51:31 -07:00
} ,
{
name : 'Get Rows' ,
value : 'getRows' ,
description : 'Retrieve a list of tablerows' ,
2022-07-10 13:50:51 -07:00
action : 'Get rows' ,
2020-03-15 16:51:31 -07:00
} ,
2020-03-26 12:44:48 -07:00
{
name : 'Lookup' ,
value : 'lookup' ,
2020-10-22 06:46:03 -07:00
description : 'Looks for a specific column value and then returns the matching row' ,
2022-07-10 13:50:51 -07:00
action : 'Look up a column' ,
2020-03-26 12:44:48 -07:00
} ,
2020-03-15 16:51:31 -07:00
] ,
default : 'addRow' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-03-15 16:51:31 -07:00
2021-12-03 00:44:16 -08:00
export const tableFields : INodeProperties [ ] = [
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* table:addRow */
/* -------------------------------------------------------------------------- */
2020-03-15 16:51:31 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Workbook Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'workbook' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
typeOptions : {
loadOptionsMethod : 'getWorkbooks' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'addRow' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Worksheet Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'worksheet' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getworksheets' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'workbook' ] ,
2020-03-15 16:51:31 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'addRow' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Table Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'table' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getTables' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'worksheet' ] ,
2020-03-15 16:51:31 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'addRow' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'addRow' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
options : [
{
displayName : 'Index' ,
name : 'index' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
} ,
2022-08-17 08:50:24 -07:00
description :
'Specifies the relative position of the new row. If not defined, the addition happens at the end. Any rows below the inserted row are shifted downwards. Zero-indexed' ,
2020-03-15 16:51:31 -07:00
} ,
] ,
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* table:getRows */
/* -------------------------------------------------------------------------- */
2020-03-15 16:51:31 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Workbook Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'workbook' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
typeOptions : {
loadOptionsMethod : 'getWorkbooks' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Worksheet Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'worksheet' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getworksheets' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'workbook' ] ,
2020-03-15 16:51:31 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Table Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'table' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getTables' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'worksheet' ] ,
2020-03-15 16:51:31 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-03-15 16:51:31 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
returnAll : [ false ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-03-15 16:51:31 -07:00
} ,
{
displayName : 'RAW Data' ,
name : 'rawData' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether the data should be returned RAW instead of parsed into keys according to their header' ,
2020-03-15 16:51:31 -07:00
} ,
2020-03-17 11:39:20 -07:00
{
displayName : 'Data Property' ,
name : 'dataProperty' ,
type : 'string' ,
default : 'data' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
rawData : [ true ] ,
2020-03-17 11:39:20 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The name of the property into which to write the RAW data' ,
2020-03-17 11:39:20 -07:00
} ,
2020-03-15 16:51:31 -07:00
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getRows' ] ,
resource : [ 'table' ] ,
rawData : [ true ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Fields the response will containt. Multiple can be added separated by ,.' ,
2020-03-15 16:51:31 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-03-15 16:51:31 -07:00
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* table:getColumns */
/* -------------------------------------------------------------------------- */
2020-03-15 16:51:31 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Workbook Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'workbook' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
typeOptions : {
loadOptionsMethod : 'getWorkbooks' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Worksheet Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'worksheet' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getworksheets' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'workbook' ] ,
2020-03-15 16:51:31 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Table Name or ID' ,
2020-03-15 16:51:31 -07:00
name : 'table' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-15 16:51:31 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getTables' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'worksheet' ] ,
2020-03-15 16:51:31 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-03-15 16:51:31 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
returnAll : [ false ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-03-15 16:51:31 -07:00
} ,
{
displayName : 'RAW Data' ,
name : 'rawData' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether the data should be returned RAW instead of parsed into keys according to their header' ,
2020-03-15 16:51:31 -07:00
} ,
2020-03-17 11:39:20 -07:00
{
displayName : 'Data Property' ,
name : 'dataProperty' ,
type : 'string' ,
default : 'data' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
rawData : [ true ] ,
2020-03-17 11:39:20 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The name of the property into which to write the RAW data' ,
2020-03-17 11:39:20 -07:00
} ,
2020-03-15 16:51:31 -07:00
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getColumns' ] ,
resource : [ 'table' ] ,
rawData : [ true ] ,
2020-03-15 16:51:31 -07:00
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Fields the response will containt. Multiple can be added separated by ,.' ,
2020-03-15 16:51:31 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-03-15 16:51:31 -07:00
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* table:lookup */
/* -------------------------------------------------------------------------- */
2020-03-26 12:44:48 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Workbook Name or ID' ,
2020-03-26 12:44:48 -07:00
name : 'workbook' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-26 12:44:48 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getWorkbooks' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'lookup' ] ,
resource : [ 'table' ] ,
2020-03-26 12:44:48 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Worksheet Name or ID' ,
2020-03-26 12:44:48 -07:00
name : 'worksheet' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-26 12:44:48 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getworksheets' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'workbook' ] ,
2020-03-26 12:44:48 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'lookup' ] ,
resource : [ 'table' ] ,
2020-03-26 12:44:48 -07:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Table Name or ID' ,
2020-03-26 12:44:48 -07:00
name : 'table' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-03-26 12:44:48 -07:00
required : true ,
typeOptions : {
loadOptionsMethod : 'getTables' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'worksheet' ] ,
2020-03-26 12:44:48 -07:00
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'lookup' ] ,
resource : [ 'table' ] ,
2020-03-26 12:44:48 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Lookup Column' ,
name : 'lookupColumn' ,
type : 'string' ,
default : '' ,
placeholder : 'Email' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'table' ] ,
operation : [ 'lookup' ] ,
2020-03-26 12:44:48 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The name of the column in which to look for value' ,
2020-03-26 12:44:48 -07:00
} ,
{
displayName : 'Lookup Value' ,
name : 'lookupValue' ,
type : 'string' ,
default : '' ,
placeholder : 'frank@example.com' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'table' ] ,
operation : [ 'lookup' ] ,
2020-03-26 12:44:48 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The value to look for in column' ,
2020-03-26 12:44:48 -07:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'table' ] ,
operation : [ 'lookup' ] ,
2020-03-26 12:44:48 -07:00
} ,
} ,
options : [
{
displayName : 'Return All Matches' ,
name : 'returnAllMatches' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
2022-08-17 08:50:24 -07:00
description :
'By default only the first result gets returned. If options gets set all found matches get returned.' ,
2020-03-26 12:44:48 -07:00
} ,
] ,
2020-10-22 06:46:03 -07:00
} ,
2021-12-03 00:44:16 -08:00
] ;