Copies a range of data from 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,
paste_orientation: PasteOrientation = PasteOrientation.normal,
)
| 3225 | return self._set_gridlines_hidden_flag(False) |
| 3226 | |
| 3227 | def copy_range( |
| 3228 | self, |
| 3229 | source: str, |
| 3230 | dest: str, |
| 3231 | paste_type: PasteType = PasteType.normal, |
| 3232 | paste_orientation: PasteOrientation = PasteOrientation.normal, |
| 3233 | ) -> JSONResponse: |
| 3234 | """Copies a range of data from source to dest |
| 3235 | |
| 3236 | .. note:: |
| 3237 | |
| 3238 | ``paste_type`` values are explained here: `Paste Types`_ |
| 3239 | |
| 3240 | .. _Paste Types: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#pastetype |
| 3241 | |
| 3242 | :param str source: The A1 notation of the source range to copy |
| 3243 | :param str dest: The A1 notation of the destination where to paste the data |
| 3244 | Can be the A1 notation of the top left corner where the range must be paste |
| 3245 | ex: G16, or a complete range notation ex: G16:I20. |
| 3246 | The dimensions of the destination range is not checked and has no effect, |
| 3247 | if the destination range does not match the source range dimension, the entire |
| 3248 | source range is copies anyway. |
| 3249 | :param paste_type: the paste type to apply. Many paste type are available from |
| 3250 | the Sheet API, see above note for detailed values for all values and their effects. |
| 3251 | Defaults to ``PasteType.normal`` |
| 3252 | :type paste_type: :class:`~gspread.utils.PasteType` |
| 3253 | :param paste_orientation: The paste orient to apply. |
| 3254 | Possible values are: ``normal`` to keep the same orientation, ``transpose`` where all rows become columns and vice versa. |
| 3255 | :type paste_orientation: :class:`~gspread.utils.PasteOrientation` |
| 3256 | """ |
| 3257 | body = { |
| 3258 | "requests": [ |
| 3259 | { |
| 3260 | "copyPaste": { |
| 3261 | "source": a1_range_to_grid_range(source, self.id), |
| 3262 | "destination": a1_range_to_grid_range(dest, self.id), |
| 3263 | "pasteType": paste_type, |
| 3264 | "pasteOrientation": paste_orientation, |
| 3265 | } |
| 3266 | } |
| 3267 | ] |
| 3268 | } |
| 3269 | |
| 3270 | return self.client.batch_update(self.spreadsheet_id, body) |
| 3271 | |
| 3272 | def cut_range( |
| 3273 | self, |