fix(Google Sheets Node): Append exceeding grid limits (#7684)

Github issue / Community forum post (link here to close automatically):
https://community.n8n.io/t/error-appending-data-with-google-sheets/28691
This commit is contained in:
Michael Kret
2023-11-15 11:33:47 +02:00
committed by GitHub
parent 4441ed5116
commit 88efb99587
3 changed files with 85 additions and 44 deletions

View File

@@ -191,6 +191,14 @@ export const description: SheetProperties = [
...handlingExtraData,
displayOptions: { show: { '/columns.mappingMode': ['autoMapInputData'] } },
},
{
displayName: 'Use Append',
name: 'useAppend',
type: 'boolean',
default: false,
description:
'Whether to use append instead of update(default), this is more efficient but in some cases data might be misaligned',
},
],
},
];
@@ -228,17 +236,28 @@ export async function execute(
if (setData.length === 0) {
return [];
} else if (options.useAppend) {
await sheet.appendSheetData(
setData,
sheetName,
headerRow,
(options.cellFormat as ValueInputOption) || cellFormatDefault(nodeVersion),
false,
undefined,
undefined,
options.useAppend as boolean,
);
} else {
await sheet.appendEmptyRowsOrColumns(sheetId, 1, 0);
}
await sheet.appendSheetData(
setData,
sheetName,
headerRow,
(options.cellFormat as ValueInputOption) || cellFormatDefault(nodeVersion),
false,
);
await sheet.appendSheetData(
setData,
sheetName,
headerRow,
(options.cellFormat as ValueInputOption) || cellFormatDefault(nodeVersion),
false,
);
}
if (nodeVersion < 4 || dataMode === 'autoMapInputData') {
return items;