MCPcopy
hub / github.com/burnash/gspread / update_index

Method update_index

gspread/worksheet.py:1673–1698  ·  view source on GitHub ↗

Updates the ``index`` property for the worksheet. See the `Sheets API documentation `_ for information on how updating the index property affects the order of worksheets in a spr

(self, index: int)

Source from the content-addressed store, hash-verified

1671 return response
1672
1673 def update_index(self, index: int) -> JSONResponse:
1674 """Updates the ``index`` property for the worksheet.
1675
1676 See the `Sheets API documentation
1677 <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#sheetproperties>`_
1678 for information on how updating the index property affects the order of worksheets
1679 in a spreadsheet.
1680
1681 To reorder all worksheets in a spreadsheet, see `Spreadsheet.reorder_worksheets`.
1682
1683 .. versionadded:: 3.4
1684 """
1685 body = {
1686 "requests": [
1687 {
1688 "updateSheetProperties": {
1689 "properties": {"sheetId": self.id, "index": index},
1690 "fields": "index",
1691 }
1692 }
1693 ]
1694 }
1695
1696 res = self.client.batch_update(self.spreadsheet_id, body)
1697 self._properties["index"] = index
1698 return res
1699
1700 def _auto_resize(
1701 self, start_index: int, end_index: int, dimension: Dimension

Callers 1

Calls 1

batch_updateMethod · 0.45

Tested by 1