From 5c244698dd13ccfc38e9c782c4c4ea4bf1af3947 Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Sun, 16 Aug 2020 23:05:45 -0700 Subject: [PATCH] fix addRows offset issue - force google API to start add rows at column A --- lib/GoogleSpreadsheetWorksheet.js | 2 +- test/rows.test.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/GoogleSpreadsheetWorksheet.js b/lib/GoogleSpreadsheetWorksheet.js index 9e277d6..d8e85c5 100644 --- a/lib/GoogleSpreadsheetWorksheet.js +++ b/lib/GoogleSpreadsheetWorksheet.js @@ -369,7 +369,7 @@ class GoogleSpreadsheetWorksheet { const response = await this._spreadsheet.axios.request({ method: 'post', - url: `/values/${this.encodedA1SheetName}:append`, + url: `/values/${this.encodedA1SheetName}!A1:append`, params: { valueInputOption: options.raw ? 'RAW' : 'USER_ENTERED', insertDataOption: options.insert ? 'INSERT_ROWS' : 'OVERWRITE', diff --git a/test/rows.test.js b/test/rows.test.js index 360673a..cf54876 100644 --- a/test/rows.test.js +++ b/test/rows.test.js @@ -10,7 +10,8 @@ let sheet; let rows; let row; -const HEADERS = ['numbers', 'letters', 'col1', 'col2', 'col3']; +// having some issues caused by blank headers, so we add one here +const HEADERS = ['numbers', 'letters', '', 'col1', 'col2', 'col3']; const INITIAL_ROW_COUNT = 15; const INITIAL_DATA = [ ['0', 'A'],