Sheets API appendValues does not use newAppendCellsRequest() and range parameter need clarification.
@jpoehnelt がすでに取り組んでいます。
2025年2月14日 から。
評価
この issue はまだ評価されていません。
説明
The Google Apps Script snippet for Sheets API Snippets.prototype.appendValues() does not use the provided Sheets.newAppendCellsRequest() sheetId and rows properties.
See
Further, the parameter range JSdoc definition is unclear. It is recommended that the definition be copied from the documentation:
The A1 notation of a range to search for a logical table of data
There are a number of issues with the Sheets.newAppendCellsRequest() that I have raised in the issue tracker here.
Two possible solutions
Both include updated JSDoc descriptions
1. Includes newAppendCellsRequest() correctly in request.
/**
* Appends values to the specified range
* @param {string} spreadsheetId spreadsheet's ID
* @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 {*[][]} _values list of rows of values to input
* @returns {*} spreadsheet with appended values
*/
Snippets.prototype.appendValues = (spreadsheetId, range,
valueInputOption, _values) => {
let values = [
[
// Cell values ...
]
// Additional rows ...
];
// [START_EXCLUDE silent]
values = _values;
// [END_EXCLUDE]
try {
let valueRange = Sheets.newRowData();
valueRange.values = values;
let appendRequest = Sheets.newAppendCellsRequest();
appendRequest.sheetId = spreadsheetId;
appendRequest.rows = valueRange;
const result = Sheets.Spreadsheets.Values.append(
appendRequest.rows,
appendRequest.sheetId,
range,
{ valueInputOption: valueInputOption }
);
return result;
} catch (err) {
// TODO (developer) - Handle exception
console.log('Failed with error %s', err.message);
}
};
2. Without newAppendCellsRequest()
/**
* Appends values to the specified range
* @param {string} spreadsheetId spreadsheet's ID
* @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 {*[][]} _values list of rows of values to input
* @returns {*} spreadsheet with appended values
*/
Snippets.prototype.appendValues = (spreadsheetId, range,
valueInputOption, _values) => {
let values = [
[
// Cell values ...
]
// Additional rows ...
];
// [START_EXCLUDE silent]
values = _values;
// [END_EXCLUDE]
try {
let valueRange = Sheets.newRowData();
valueRange.values = values;
const result = Sheets.Spreadsheets.Values.append(valueRange, spreadsheetId,
range, {valueInputOption: valueInputOption});
return result;
} catch (err) {
// TODO (developer) - Handle exception
console.log('Failed with error %s', err.message);
}
};
- 主要言語
- JavaScript
- スター
- 5.2k
- フォーク
- 2k
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleworkspace/apps-script-samples のほかの issue
-
Alvin Litana Mirasol オープン
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
googleworkspace/apps-script-samples#659 · コメント 1 件 · リアクション 1 件 ·
-
Password reset オープン
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
googleworkspace/apps-script-samples#654 · リアクション 2 件 ·
-
cod gs オープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
googleworkspace/apps-script-samples#651 · リアクション 1 件 ·
-
tespogrome オープン
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
googleworkspace/apps-script-samples#624 · リアクション 1 件 ·
-
googleworkspace/apps-script-samples#616 · 担当者 1 名 ·
googleworkspace/apps-script-samples の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mksglu/context-mode#1200 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
neondatabase/website#5944 ·
-
module: core
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bigbluebutton/bigbluebutton#25849 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
jaegertracing/jaeger-ui#4506 ·