My code is:
function Test_Copy() {
var spreadsheetId = "MY_FILE_ID";
var sheetId = "SHEET_ID";
var rangeFrom = Sheets.newGridRange();
rangeFrom.sheetId = sheetId;
rangeFrom.startRowIndex = 0;
rangeFrom.endRowIndex = 1;
rangeFrom.startColumnIndex = 0;
rangeFrom.endColumnIndex = 1;
var rangeTo = Sheets.newGridRange();
rangeTo.sheetId = sheetId;
rangeTo.startRowIndex = 1;
rangeTo.endRowIndex = 2;
rangeTo.startColumnIndex = 1;
rangeTo.endColumnIndex = 2;
var request = Sheets.newCopyPasteRequest();
request.destination = rangeTo
request.source = rangeFrom
request.pasteType = "PASTE_NORMAL";
request.pasteOrientation = "NORMAL";
var resource = Sheets.newBatchUpdateSpreadsheetRequest();
resource.requests = [request];
Sheets.Spreadsheets.batchUpdate(resource , spreadsheetId);
}
When I run it, I get the error:
API call to sheets.spreadsheets.batchUpdate failed with error: Invalid JSON payload received. Unknown name "pasteType"
I use Google-Sheets-Api, (here's how I enabled it)
{requests:[requestObj]}
– TheMaster