mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(Google Sheets Node): Add column names row if sheet is empty (#10200)
Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
parent
5136d10ca3
commit
82eba9fc5f
|
@ -275,7 +275,10 @@ export async function execute(
|
|||
//if no trailing empty row exists in the sheet update operation will fail
|
||||
await sheet.appendEmptyRowsOrColumns(sheetId, 1, 0);
|
||||
|
||||
const lastRow = (sheetData ?? []).length + 1;
|
||||
// if sheetData is undefined it means that the sheet was empty
|
||||
// we did add row with column names in the first row (autoMapInputData)
|
||||
// to account for that length has to be 1 and we append data in the next row
|
||||
const lastRow = (sheetData ?? [{}]).length + 1;
|
||||
|
||||
await sheet.appendSheetData({
|
||||
inputData,
|
||||
|
|
Loading…
Reference in a new issue