From 39e94a7c4ba92db49f31b9bde01c0e8dce171c8d Mon Sep 17 00:00:00 2001 From: Yagisanatode Date: Fri, 14 Feb 2025 15:28:52 +0700 Subject: [PATCH] Update spreadsheet_snippets.gs Uses Sheets.newAppendCellsRequest() in request for the rows and sheet id. Updates the `range` parameter description to to the one found in the documentation. Updates the `_values` param to correct JSdoc format. --- sheets/api/spreadsheet_snippets.gs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sheets/api/spreadsheet_snippets.gs b/sheets/api/spreadsheet_snippets.gs index 4d08b67b3..5ba313ede 100644 --- a/sheets/api/spreadsheet_snippets.gs +++ b/sheets/api/spreadsheet_snippets.gs @@ -231,11 +231,11 @@ Snippets.prototype.batchUpdateValues = /** * Appends values to the specified range * @param {string} spreadsheetId spreadsheet's ID - * @param {string} range range of cells in the spreadsheet + * @param {string} range The A1 notation of a range to search for a logical table of data. * @param valueInputOption determines how the input should be interpreted * @see * https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption - * @param {list} _values list of rows of values to input + * @param {*[][]} _values list of rows of values to input * @returns {*} spreadsheet with appended values */ Snippets.prototype.appendValues = (spreadsheetId, range, @@ -255,10 +255,14 @@ Snippets.prototype.appendValues = (spreadsheetId, range, let appendRequest = Sheets.newAppendCellsRequest(); appendRequest.sheetId = spreadsheetId; - appendRequest.rows = [valueRange]; - - const result = Sheets.Spreadsheets.Values.append(valueRange, spreadsheetId, - range, {valueInputOption: valueInputOption}); + appendRequest.rows = valueRange; + + const result = Sheets.Spreadsheets.Values.append( + appendRequest.rows, + appendRequest.sheetId, + range, + { valueInputOption: valueInputOption } + ); return result; } catch (err) { // TODO (developer) - Handle exception