mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(Google Sheets Node): Allow to use header names as JSON path (#3165)
* Add option to match key by keypath when append data to google sheet * ⚡ Fix build issue and option order Co-authored-by: Jack Rudenko <i@madappgang.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -579,6 +579,20 @@ export class GoogleSheets implements INodeType {
|
||||
},
|
||||
description: 'By default only the first result gets returned. If options gets set all found matches get returned.',
|
||||
},
|
||||
{
|
||||
displayName: 'Use Header Names as JSON Paths',
|
||||
name: 'usePathForKeyRow',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/operation': [
|
||||
'append',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Enable if you want to match the headers as path, for example, the row header "category.name" will match the "category" object and get the field "name" from it. By default "category.name" will match with the field with exact name, not nested object.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value Input Mode',
|
||||
name: 'valueInputMode',
|
||||
@@ -674,7 +688,6 @@ export class GoogleSheets implements INodeType {
|
||||
default: 'UNFORMATTED_VALUE',
|
||||
description: 'Determines how values should be rendered in the output.',
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1089,8 +1102,10 @@ export class GoogleSheets implements INodeType {
|
||||
setData.push(item.json);
|
||||
});
|
||||
|
||||
const usePathForKeyRow = (options.usePathForKeyRow || false) as boolean;
|
||||
|
||||
// Convert data into array format
|
||||
const data = await sheet.appendSheetData(setData, sheet.encodeRange(range), keyRow, valueInputMode);
|
||||
const data = await sheet.appendSheetData(setData, sheet.encodeRange(range), keyRow, valueInputMode, usePathForKeyRow);
|
||||
|
||||
// TODO: Should add this data somewhere
|
||||
// TODO: Should have something like add metadata which does not get passed through
|
||||
|
||||
Reference in New Issue
Block a user