fix(Google Sheets Node): Insert data if sheet is empty instead of error (#10942)

This commit is contained in:
Michael Kret
2024-09-24 18:41:07 +03:00
committed by GitHub
parent ad60d49b42
commit c75990e063
5 changed files with 178 additions and 6 deletions

View File

@@ -211,7 +211,7 @@ export async function execute(
): Promise<INodeExecutionData[]> {
const items = this.getInputData();
const nodeVersion = this.getNode().typeVersion;
const dataMode =
let dataMode =
nodeVersion < 4
? (this.getNodeParameter('dataMode', 0) as string)
: (this.getNodeParameter('columns.mappingMode', 0) as string);
@@ -228,6 +228,10 @@ export async function execute(
const sheetData = await sheet.getData(range, 'FORMATTED_VALUE');
if (sheetData === undefined || !sheetData.length) {
dataMode = 'autoMapInputData';
}
if (nodeVersion >= 4.4 && dataMode !== 'autoMapInputData') {
//not possible to refresh columns when mode is autoMapInputData
if (sheetData?.[keyRowIndex - 1] === undefined) {