Skip to content

Commit

Permalink
fix(Google Sheets Node): Add column names row if sheet is empty (#10200)
Browse files Browse the repository at this point in the history
Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
  • Loading branch information
michael-radency and ShireenMissi authored Jul 26, 2024
1 parent 5136d10 commit 82eba9f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 82eba9f

Please # to comment.