Method: spreadsheets.values.update
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คำขอ HTTP
PUT https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
spreadsheetId |
string
รหัสของสเปรดชีตที่จะอัปเดต
|
range |
string
การเขียน A1 ของค่าที่จะอัปเดต
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
valueInputOption |
enum (ValueInputOption )
วิธีการตีความข้อมูลอินพุต
|
includeValuesInResponse |
boolean
กำหนดว่าคำตอบการอัปเดตควรรวมค่าของเซลล์ที่อัปเดตหรือไม่ โดยค่าเริ่มต้น คำตอบจะไม่รวมค่าที่อัปเดต หากช่วงที่จะเขียนมีขนาดใหญ่กว่าช่วงที่เขียนจริง คำตอบจะมีค่าทั้งหมดในช่วงที่ขอ (ไม่รวมแถวและคอลัมน์ว่างต่อท้าย)
|
responseValueRenderOption |
enum (ValueRenderOption )
กำหนดวิธีแสดงผลค่าในการตอบกลับ ตัวเลือกการแสดงผลเริ่มต้นคือ FORMATTED_VALUE
|
responseDateTimeRenderOption |
enum (DateTimeRenderOption )
กำหนดวิธีแสดงผลวันที่ เวลา และระยะเวลาในการตอบกลับ ระบบจะละเว้นค่านี้หาก responseValueRenderOption เป็น FORMATTED_VALUE ตัวเลือกการแสดงผล dateTime เริ่มต้นคือ SERIAL_NUMBER
|
เนื้อหาของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ ValueRange
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ UpdateValuesResponse
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth ต่อไปนี้
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-03-22 UTC
[null,null,["อัปเดตล่าสุด 2025-03-22 UTC"],[],[],null,["# Method: spreadsheets.values.update\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nSets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a [valueInputOption](/workspace/sheets/api/reference/rest/v4/ValueInputOption).\n\n### HTTP request\n\n`PUT https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------------|\n| `spreadsheetId` | `string` The ID of the spreadsheet to update. |\n| `range` | `string` The [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the values to update. |\n\n### Query parameters\n\n| Parameters ||\n|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `valueInputOption` | `enum (`[ValueInputOption](/workspace/sheets/api/reference/rest/v4/ValueInputOption)`)` How the input data should be interpreted. |\n| `includeValuesInResponse` | `boolean` Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns). |\n| `responseValueRenderOption` | `enum (`[ValueRenderOption](/workspace/sheets/api/reference/rest/v4/ValueRenderOption)`)` Determines how values in the response should be rendered. The default render option is [FORMATTED_VALUE](/workspace/sheets/api/reference/rest/v4/ValueRenderOption). |\n| `responseDateTimeRenderOption` | `enum (`[DateTimeRenderOption](/workspace/sheets/api/reference/rest/v4/DateTimeRenderOption)`)` Determines how dates, times, and durations in the response should be rendered. This is ignored if [responseValueRenderOption](/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update#body.QUERY_PARAMETERS.response_value_render_option) is [FORMATTED_VALUE](/workspace/sheets/api/reference/rest/v4/ValueRenderOption). The default dateTime render option is [SERIAL_NUMBER](/workspace/sheets/api/reference/rest/v4/DateTimeRenderOption). |\n\n### Request body\n\nThe request body contains an instance of [ValueRange](/workspace/sheets/api/reference/rest/v4/spreadsheets.values#ValueRange).\n\n### Response body\n\nIf successful, the response body contains an instance of [UpdateValuesResponse](/workspace/sheets/api/reference/rest/v4/UpdateValuesResponse).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `https://www.googleapis.com/auth/drive.file`\n- `https://www.googleapis.com/auth/spreadsheets`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]