diff --git a/packages/nodes-base/nodes/SpreadsheetFile.node.ts b/packages/nodes-base/nodes/SpreadsheetFile.node.ts index 37fb564e09..ecac7db2cd 100644 --- a/packages/nodes-base/nodes/SpreadsheetFile.node.ts +++ b/packages/nodes-base/nodes/SpreadsheetFile.node.ts @@ -196,6 +196,20 @@ export class SpreadsheetFile implements INodeType { default: false, description: 'If the data should be returned RAW instead of parsed.', }, + { + displayName: 'Read As String', + name: 'readAsString', + type: 'boolean', + displayOptions: { + show: { + '/operation': [ + 'fromFile' + ], + }, + }, + default: false, + description: 'In some cases and file formats, it is necessary to read
specifically as string else some special character get interpreted wrong.', + }, { displayName: 'Sheet Name', name: 'sheetName', @@ -259,7 +273,12 @@ export class SpreadsheetFile implements INodeType { // Read the binary spreadsheet data const binaryData = Buffer.from(item.binary[binaryPropertyName].data, BINARY_ENCODING); - const workbook = xlsxRead(binaryData, { raw: options.rawData as boolean }); + let workbook; + if (options.readAsString === true) { + workbook = xlsxRead(binaryData.toString(), { type: 'string', raw: options.rawData as boolean }); + } else { + workbook = xlsxRead(binaryData, { raw: options.rawData as boolean }); + } if (workbook.SheetNames.length === 0) { throw new Error('Spreadsheet does not have any sheets!');