設定試算表中一或多個範圍的值。呼叫端必須指定試算表 ID、valueInputOption 和一或多個 ValueRanges。
HTTP 要求
POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchUpdate
這個網址使用 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[] | 
 每個要求範圍一個 UpdateValuesResponse,且順序與要求出現的順序相同。 | 
授權範圍
需要下列其中一種 OAuth 範圍:
- https://www.googleapis.com/auth/drive
- https://www.googleapis.com/auth/drive.file
- https://www.googleapis.com/auth/spreadsheets
詳情請參閱授權指南。