在試算表的一或多個範圍中設定值。詳情請參閱「讀取、寫入及搜尋中繼資料」。
呼叫者必須指定試算表 ID、valueInputOption 和一或多個 DataFilterValueRanges。
HTTP 要求
POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchUpdateByDataFilter
這個網址使用 gRPC 轉碼語法。
路徑參數
| 參數 | |
|---|---|
spreadsheetId |
要更新的試算表 ID。 |
要求主體
要求主體會包含結構如下的資料:
| JSON 表示法 |
|---|
{ "valueInputOption": enum ( |
| 欄位 | |
|---|---|
valueInputOption |
如何解讀輸入資料。 |
data[] |
要套用至試算表的新值。如果指定 |
includeValuesInResponse |
判斷更新回應是否應包含更新的儲存格值。根據預設,回應不會包含更新後的值。每個 |
responseValueRenderOption |
決定如何算繪回應中的值。預設的算繪選項為 |
responseDateTimeRenderOption |
決定如何呈現回覆中的日期、時間和時長。如果 |
回應主體
更新試算表中的值範圍時的回應。
如果成功,回應主體會含有以下結構的資料:
| JSON 表示法 |
|---|
{
"spreadsheetId": string,
"totalUpdatedRows": integer,
"totalUpdatedColumns": integer,
"totalUpdatedCells": integer,
"totalUpdatedSheets": integer,
"responses": [
{
object ( |
| 欄位 | |
|---|---|
spreadsheetId |
套用更新的試算表。 |
totalUpdatedRows |
至少有一個儲存格更新的資料列總數。 |
totalUpdatedColumns |
至少有一個儲存格更新的欄總數。 |
totalUpdatedCells |
更新的儲存格總數。 |
totalUpdatedSheets |
至少有一個儲存格更新的工作表總數。 |
responses[] |
每個更新範圍的回應。 |
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/spreadsheets
詳情請參閱授權指南。
DataFilterValueRange
位置由 DataFilter 指定的值範圍。
| JSON 表示法 |
|---|
{ "dataFilter": { object ( |
| 欄位 | |
|---|---|
dataFilter |
資料篩選器,說明試算表中值的所在位置。 |
majorDimension |
值的主要維度。 |
values[] |
要寫入的資料。如果提供的值超過資料篩選條件比對的任何範圍,要求就會失敗。如果提供的值少於相符範圍,系統只會寫入指定值,相符範圍中的現有值不會受到影響。 |
UpdateValuesByDataFilterResponse
在試算表中透過資料篩選器更新值範圍時的回應。
| JSON 表示法 |
|---|
{ "updatedRange": string, "updatedRows": integer, "updatedColumns": integer, "updatedCells": integer, "dataFilter": { object ( |
| 欄位 | |
|---|---|
updatedRange |
套用更新的範圍 (以 A1 標記表示)。 |
updatedRows |
至少有一個儲存格更新的資料列數量。 |
updatedColumns |
至少有一個儲存格更新的欄數。 |
updatedCells |
更新的儲存格數量。 |
dataFilter |
選取已更新範圍的資料篩選器。 |
updatedData |
套用所有更新後,dataFilter 比對範圍內儲存格的值。只有在要求的 |