My function will not work inside an "IF" formula. But works fine on its own

function datepaste(value1) {

if(value1 >0){

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet()
var cell = sheet.getActiveCell()
var range = sheet.getRange(“G55”).copyTo(sheet.getActiveCell().offset(-0,-2), {contentsOnly:true});


/*The above works fine when run by itself with out the “IF” formula. However when run in an “IF” in the spreadsheet, I get the error 'You do not have permission to call copy to (line9). I attached a pic of the script screen.

This is written out in google script editor. Please let me know if you can how to get it to work inside an if formula as I have tried to do in the above example.

you would have to start your journey
with a google search through the site
which is used by a lot of programmers…
Try it…
== discussions /opinions ==