0

I'm launching the cutPaste method of the google sheets api documented here: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#cutpasterequest

in the manner described here: https://developers.google.com/sheets/api/samples/data#cut_and_paste_cells

using the pygsheets python library.

I tried with both PASTE_NORMAL and PASTE_VALUES but and nothing happens. No error returned, no action taken whatsoever.

Same thing with copyPaste().

All other batchUpdate functions I used, like addSheet() (as well as non-batchUpdate functions), work flawlessly.

Any clues?

def copy_paste(sheet, orig_start, orig_end, dest_start, dest_end):
    sheet.client.sh_batch_update(sheet.spreadsheet.id, {
        'copyPaste': {
            'source': pygsheets.DataRange(start=orig_start, end=orig_end, 
                                          worksheet=sheet)
                               ._get_gridrange(),
            'destination': pygsheets.DataRange(start=orig_start, end=orig_end,
                                               worksheet=sheet)
                               ._get_gridrange(),
            'pasteType': 'PASTE_VALUES',
            'pasteOrientation': 'NORMAL',
        }
    })  

copy_paste(sheet, 'A1', 'A2', 'B1', 'B2')

Update I've shared the worksheet https://docs.google.com/spreadsheets/d/1UCH0eW1UEksn1HjKxba50PVKvIivkWZnjX2Nd-aIE0c/edit?usp=sharing

Here's the google api enter image description here

Here's the request

enter image description here

And here's the response

enter image description here

Antony Hatchkins
  • 31,947
  • 10
  • 111
  • 111
  • please show the code you have tried – Nithin Nov 23 '17 at 07:13
  • @nithin added the code – Antony Hatchkins Nov 23 '17 at 07:31
  • @nithin I've raised the corresponding issue in their bugtracker but according to the stats they have it's likely to be reviewed only in about a month. – axil Nov 23 '17 at 17:04
  • @axil this dosent seem like a pygsheets issue though, btw i didn't see any issue raised related to this. – Nithin Nov 24 '17 at 05:44
  • @AntonyHatchkins did you try this (copyPaste) using google api explorer? Is this working fine there? – Nithin Nov 24 '17 at 05:45
  • @AntonyHatchkins, try using Apps Script and Advance Google Service to test it. Tried it earlier and it is working as intended. I think you can mention it to pygsheets, to take a look at `copy_paste` function. – Mr.Rebot Nov 25 '17 at 21:29
  • @nithin I've added the screenshots from GoogleApiExplorer. It works exactly as in pygsheets (nothing happens). – Antony Hatchkins Nov 26 '17 at 18:32
  • @MrRebot I don't see copy_paste function in the pygsheets. If it doesn't work with GoogleApiExplorer I don't think it's likely to work with AppsScript or AdvancedGoogleService, is it? – Antony Hatchkins Nov 26 '17 at 18:37
  • @nithin It's here: https://issuetracker.google.com/issues/69701407 – axil Nov 29 '17 at 17:05

0 Answers0