fix(Google Sheets Node): Fix for append operation if no empty rows in sheet

This commit is contained in:
Michael Kret
2022-12-01 10:39:03 +02:00
committed by GitHub
parent 6d4e959884
commit 741c7da8b1
8 changed files with 211 additions and 171 deletions

View File

@@ -247,23 +247,22 @@ export async function execute(
} else {
const valueToMatchOn = this.getNodeParameter('valueToMatchOn', i) as string;
const fields = (this.getNodeParameter('fieldsUi.values', i, {}) as IDataObject[]).reduce(
(acc, entry) => {
if (entry.column === 'newColumn') {
const columnName = entry.columnName as string;
const fields = (
(this.getNodeParameter('fieldsUi.values', i, {}) as IDataObject[]) || []
).reduce((acc, entry) => {
if (entry.column === 'newColumn') {
const columnName = entry.columnName as string;
if (columnNames.includes(columnName) === false) {
newColumns.add(columnName);
}
acc[columnName] = entry.fieldValue as string;
} else {
acc[entry.column as string] = entry.fieldValue as string;
if (columnNames.includes(columnName) === false) {
newColumns.add(columnName);
}
return acc;
},
{} as IDataObject,
);
acc[columnName] = entry.fieldValue as string;
} else {
acc[entry.column as string] = entry.fieldValue as string;
}
return acc;
}, {} as IDataObject);
fields[columnToMatchOn] = valueToMatchOn;