From abe1ee144ab80ed810e9ee36e25ddd3bb7530b1c Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Fri, 7 May 2021 22:51:00 -0500 Subject: [PATCH] :zap: Minor fix on Spreadsheet File --- .../nodes/SpreadsheetFile.node.json | 6 +-- .../nodes-base/nodes/SpreadsheetFile.node.ts | 40 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/nodes-base/nodes/SpreadsheetFile.node.json b/packages/nodes-base/nodes/SpreadsheetFile.node.json index 0f004d1d7c..ce41ae2dae 100644 --- a/packages/nodes-base/nodes/SpreadsheetFile.node.json +++ b/packages/nodes-base/nodes/SpreadsheetFile.node.json @@ -1,7 +1,7 @@ { "node": "n8n-nodes-base.spreadsheetFile", - "nodeVersion": "1.1", - "codexVersion": "1.1", + "nodeVersion": "1.0", + "codexVersion": "1.0", "categories": [ "Data & Storage", "Core Nodes" @@ -20,4 +20,4 @@ } ] } -} \ No newline at end of file +} diff --git a/packages/nodes-base/nodes/SpreadsheetFile.node.ts b/packages/nodes-base/nodes/SpreadsheetFile.node.ts index 22208facf0..e2b8350a84 100644 --- a/packages/nodes-base/nodes/SpreadsheetFile.node.ts +++ b/packages/nodes-base/nodes/SpreadsheetFile.node.ts @@ -207,6 +207,20 @@ export class SpreadsheetFile implements INodeType { default: '', description: 'File name to set in binary data. By default will "spreadsheet." be used.', }, + { + displayName: 'Header Row', + name: 'headerRow', + type: 'boolean', + displayOptions: { + show: { + '/operation': [ + 'fromFile', + ], + }, + }, + default: true, + description: 'The first row of the file contains the header names.', + }, { displayName: 'Include Empty Cells', name: 'includeEmptyCells', @@ -296,20 +310,6 @@ export class SpreadsheetFile implements INodeType { default: 'Sheet', description: 'Name of the sheet to create in the spreadsheet.', }, - { - displayName: 'Header Row', - name: 'headerRow', - type: 'boolean', - displayOptions: { - show: { - '/operation': [ - 'fromFile', - ], - }, - }, - default: true, - description: 'Consider the first row as the header row or a data row.', - }, ], }, ], @@ -373,7 +373,7 @@ export class SpreadsheetFile implements INodeType { if (options.includeEmptyCells) { sheetToJsonOptions.defval = ''; } - if (!options.headerRow) { + if (options.headerRow === false) { sheetToJsonOptions.header = 1; // Consider the first row as a data row } @@ -385,15 +385,15 @@ export class SpreadsheetFile implements INodeType { } // Add all the found data columns to the workflow data - if (options.headerRow) { - for (const rowData of sheetJson) { - newItems.push({ json: rowData } as INodeExecutionData); - } - } else { + if (options.headerRow === false) { // Data was returned as an array - https://github.com/SheetJS/sheetjs#json for (const rowData of sheetJson) { newItems.push({ json: { row: rowData } } as INodeExecutionData); } + } else { + for (const rowData of sheetJson) { + newItems.push({ json: rowData } as INodeExecutionData); + } } }