fix(Google Sheets Node): Insert data if sheet is empty instead of error (#10942)
This commit is contained in:
@@ -257,7 +257,7 @@ export async function execute(
|
||||
}
|
||||
}
|
||||
|
||||
const dataMode =
|
||||
let dataMode =
|
||||
nodeVersion < 4
|
||||
? (this.getNodeParameter('dataMode', 0) as string)
|
||||
: (this.getNodeParameter('columns.mappingMode', 0) as string);
|
||||
@@ -267,10 +267,14 @@ export async function execute(
|
||||
const sheetData = (await sheet.getData(sheetName, 'FORMATTED_VALUE')) ?? [];
|
||||
|
||||
if (!sheetData[keyRowIndex] && dataMode !== 'autoMapInputData') {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Could not retrieve the column names from row ${keyRowIndex + 1}`,
|
||||
);
|
||||
if (!sheetData.length) {
|
||||
dataMode = 'autoMapInputData';
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Could not retrieve the column names from row ${keyRowIndex + 1}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
columnNames = sheetData[keyRowIndex] ?? [];
|
||||
|
||||
Reference in New Issue
Block a user