Method: spreadsheets.values.batchClear

清除試算表中一或多個範圍的值。呼叫端必須指定試算表 ID 和一或多個範圍。系統只會清除值,保留儲存格的其他所有屬性 (例如格式和資料驗證)。

HTTP 要求

POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchClear

這個網址使用 gRPC 轉碼語法。

路徑參數

參數
spreadsheetId

string

要更新的試算表 ID。

要求主體

要求主體的資料會採用以下結構:

JSON 表示法
{
  "ranges": [
    string
  ]
}
欄位
ranges[]

string

要清除的範圍,請使用 A1 標記法或 R1C1 標記法

回應主體

清除試算表中特定範圍的值時的回應。

如果成功,回應主體即會包含具有以下結構的資料:

JSON 表示法
{
  "spreadsheetId": string,
  "clearedRanges": [
    string
  ]
}
欄位
spreadsheetId

string

套用更新的試算表。

clearedRanges[]

string

已清除的範圍 (使用 A1 標記法)。如果要求範圍是未界限或大於工作表邊界的範圍範圍,則這是實際清除且受限於工作表限制的實際範圍。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/drive
  • https://www.googleapis.com/auth/drive.file
  • https://www.googleapis.com/auth/spreadsheets

詳情請參閱授權指南