diff --git a/packages/nodes-base/nodes/SpreadsheetFile.node.ts b/packages/nodes-base/nodes/SpreadsheetFile.node.ts index 9f82a2b950..c4026f86e2 100644 --- a/packages/nodes-base/nodes/SpreadsheetFile.node.ts +++ b/packages/nodes-base/nodes/SpreadsheetFile.node.ts @@ -166,22 +166,36 @@ export class SpreadsheetFile implements INodeType { name: 'options', type: 'collection', placeholder: 'Add Option', - displayOptions: { - show: { - operation: [ - 'toFile', - ], - }, - }, default: {}, options: [ { displayName: 'File Name', name: 'fileName', type: 'string', + displayOptions: { + show: { + '/operation': [ + 'toFile', + ], + }, + }, default: '', description: 'File name to set in binary data. By default will "spreadsheet." be used.', }, + { + displayName: 'RAW Data', + name: 'rawData', + type: 'boolean', + displayOptions: { + show: { + '/operation': [ + 'fromFile' + ], + }, + }, + default: false, + description: 'If the data should be returned RAW instead of parsed.', + }, ], }, ] @@ -203,7 +217,8 @@ export class SpreadsheetFile implements INodeType { for (let i = 0; i < items.length; i++) { item = items[i]; - const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string; + const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; + const options = this.getNodeParameter('options', i, {}) as IDataObject; if (item.binary === undefined || item.binary[binaryPropertyName] === undefined) { // Property did not get found on item @@ -212,7 +227,7 @@ export class SpreadsheetFile implements INodeType { // Read the binary spreadsheet data const binaryData = Buffer.from(item.binary[binaryPropertyName].data, BINARY_ENCODING); - const workbook = xlsxRead(binaryData); + const workbook = xlsxRead(binaryData, { raw: options.rawData as boolean }); if (workbook.SheetNames.length === 0) { throw new Error('File does not have any sheets!'); @@ -235,9 +250,9 @@ export class SpreadsheetFile implements INodeType { return this.prepareOutputData(newItems); } else if (operation === 'toFile') { // Write the workflow data to spreadsheet file - const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string; - const fileFormat = this.getNodeParameter('fileFormat', 0) as string; - const options = this.getNodeParameter('options', 0, {}) as IDataObject; + const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; + const fileFormat = this.getNodeParameter('fileFormat', i) as string; + const options = this.getNodeParameter('options', i, {}) as IDataObject; // Get the json data of the items and flatten it let item: INodeExecutionData;