Moves a range of data form source to dest .. note:: ``paste_type`` values are explained here: `Paste Types`_ .. _Paste Types: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#pastetype :param str source: The A1 notation of the
(
self,
source: str,
dest: str,
paste_type: PasteType = PasteType.normal,
)
| 3270 | return self.client.batch_update(self.spreadsheet_id, body) |
| 3271 | |
| 3272 | def cut_range( |
| 3273 | self, |
| 3274 | source: str, |
| 3275 | dest: str, |
| 3276 | paste_type: PasteType = PasteType.normal, |
| 3277 | ) -> JSONResponse: |
| 3278 | """Moves a range of data form source to dest |
| 3279 | |
| 3280 | .. note:: |
| 3281 | |
| 3282 | ``paste_type`` values are explained here: `Paste Types`_ |
| 3283 | |
| 3284 | .. _Paste Types: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#pastetype |
| 3285 | |
| 3286 | :param str source: The A1 notation of the source range to move |
| 3287 | :param str dest: The A1 notation of the destination where to paste the data |
| 3288 | **it must be a single cell** in the A1 notation. ex: G16 |
| 3289 | :param paste_type: the paste type to apply. Many paste type are available from |
| 3290 | the Sheet API, see above note for detailed values for all values and their effects. |
| 3291 | Defaults to ``PasteType.normal`` |
| 3292 | :type paste_type: :class:`~gspread.utils.PasteType` |
| 3293 | """ |
| 3294 | |
| 3295 | # in the cut/paste request, the destination object |
| 3296 | # is a `gridCoordinate` and not a `gridRang` |
| 3297 | # it has different object keys |
| 3298 | grid_dest = a1_range_to_grid_range(dest, self.id) |
| 3299 | |
| 3300 | body = { |
| 3301 | "requests": [ |
| 3302 | { |
| 3303 | "cutPaste": { |
| 3304 | "source": a1_range_to_grid_range(source, self.id), |
| 3305 | "destination": { |
| 3306 | "sheetId": grid_dest["sheetId"], |
| 3307 | "rowIndex": grid_dest["startRowIndex"], |
| 3308 | "columnIndex": grid_dest["startColumnIndex"], |
| 3309 | }, |
| 3310 | "pasteType": paste_type, |
| 3311 | } |
| 3312 | } |
| 3313 | ] |
| 3314 | } |
| 3315 | |
| 3316 | return self.client.batch_update(self.spreadsheet_id, body) |
| 3317 | |
| 3318 | def add_validation( |
| 3319 | self, |