diff --git a/packages/nodes-base/nodes/Google/Sheet/GoogleSheets.node.ts b/packages/nodes-base/nodes/Google/Sheet/GoogleSheets.node.ts index 8096ae53b7..b5cd0ced1a 100644 --- a/packages/nodes-base/nodes/Google/Sheet/GoogleSheets.node.ts +++ b/packages/nodes-base/nodes/Google/Sheet/GoogleSheets.node.ts @@ -21,6 +21,10 @@ import { ValueRenderOption, } from './GoogleSheet'; +import { + googleApiRequest, +} from './GenericFunctions'; + export class GoogleSheets implements INodeType { description: INodeTypeDescription = { displayName: 'Google Sheets ', @@ -28,6 +32,7 @@ export class GoogleSheets implements INodeType { icon: 'file:googlesheets.png', group: ['input', 'output'], version: 1, + subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', description: 'Read, update and write data to Google Sheets', defaults: { name: 'Google Sheets', @@ -76,10 +81,35 @@ export class GoogleSheets implements INodeType { ], default: 'serviceAccount', }, + { + displayName: 'Resource', + name: 'resource', + type: 'options', + options: [ + { + name: 'Spreadsheet', + value: 'spreadsheet', + }, + { + name: 'Sheet', + value: 'sheet', + }, + + ], + default: 'sheet', + description: 'The operation to perform.', + }, { displayName: 'Operation', name: 'operation', type: 'options', + displayOptions: { + show: { + resource: [ + 'sheet', + ], + }, + }, options: [ { name: 'Append', @@ -123,6 +153,13 @@ export class GoogleSheets implements INodeType { displayName: 'Sheet ID', name: 'sheetId', type: 'string', + displayOptions: { + show: { + resource: [ + 'sheet', + ], + }, + }, default: '', required: true, description: 'The ID of the Google Sheet.
Found as part of the sheet URL https://docs.google.com/spreadsheets/d/{ID}/', @@ -132,6 +169,11 @@ export class GoogleSheets implements INodeType { name: 'range', type: 'string', displayOptions: { + show: { + resource: [ + 'sheet', + ], + }, hide: { operation: [ 'delete', @@ -158,6 +200,9 @@ export class GoogleSheets implements INodeType { }, displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'delete', ], @@ -254,6 +299,9 @@ export class GoogleSheets implements INodeType { type: 'boolean', displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'read', ], @@ -269,6 +317,9 @@ export class GoogleSheets implements INodeType { default: 'data', displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'read', ], @@ -289,6 +340,9 @@ export class GoogleSheets implements INodeType { type: 'boolean', displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'update', ], @@ -304,6 +358,9 @@ export class GoogleSheets implements INodeType { default: 'data', displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'update', ], @@ -327,6 +384,11 @@ export class GoogleSheets implements INodeType { }, default: 1, displayOptions: { + show: { + resource: [ + 'sheet', + ], + }, hide: { operation: [ 'append', @@ -352,6 +414,11 @@ export class GoogleSheets implements INodeType { minValue: 0, }, displayOptions: { + show: { + resource: [ + 'sheet', + ], + }, hide: { operation: [ 'clear', @@ -379,6 +446,9 @@ export class GoogleSheets implements INodeType { required: true, displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'lookup', ], @@ -394,6 +464,9 @@ export class GoogleSheets implements INodeType { placeholder: 'frank@example.com', displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'lookup', ], @@ -412,6 +485,9 @@ export class GoogleSheets implements INodeType { default: 'id', displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'update', ], @@ -431,6 +507,9 @@ export class GoogleSheets implements INodeType { default: {}, displayOptions: { show: { + resource: [ + 'sheet', + ], operation: [ 'append', 'lookup', @@ -566,6 +645,144 @@ export class GoogleSheets implements INodeType { ], }, + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'spreadsheet', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a spreadsheet', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, + // ---------------------------------- + // spreadsheet:create + // ---------------------------------- + { + displayName: 'Title', + name: 'title', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'spreadsheet', + ], + operation: [ + 'create', + ], + }, + }, + description: 'The title of the spreadsheet.', + }, + { + displayName: 'Sheets', + name: 'sheetsUi', + placeholder: 'Add Sheet', + type: 'fixedCollection', + typeOptions: { + multipleValues: true, + }, + default: {}, + options: [ + { + name: 'sheetValues', + displayName: 'Sheet', + values: [ + { + displayName: 'Sheet Properties', + name: 'propertiesUi', + placeholder: 'Add Property', + type: 'collection', + default: {}, + options: [ + { + displayName: 'Hidden', + name: 'hidden', + type: 'boolean', + default: false, + description: 'If the Sheet should be hidden in the UI', + }, + { + displayName: 'Title', + name: 'title', + type: 'string', + default: '', + description: 'Title of the property to create', + }, + ], + }, + ], + }, + ], + }, + { + displayName: 'Options', + name: 'options', + type: 'collection', + placeholder: 'Add Option', + default: {}, + displayOptions: { + show: { + resource: [ + 'spreadsheet', + ], + operation: [ + 'create', + ], + }, + }, + options: [ + { + displayName: 'Locale', + name: 'locale', + type: 'string', + default: '', + placeholder: 'en_US', + description: 'The locale of the spreadsheet in one of the following formats: