Need help for a script that works without the need to open google sheet

Hi Guys, i am hitting a wall which i cannot break right now. I need to create a google spreadsheet script that work together with appsheet WITHOUT the need to open the sheet file.

Here is the logic inside my head

IF the value of a cell in column 14 (column N) is “ONLINE”, >
then move the entire row
to the last row available in the “KOLOM ONLINE” sheet.

and here is my curent script that works but i need to open the sheet to get it work, which is annoying

function onChange(event) {
// assumes source data in sheet named Needed
// target sheet of move to named Acquired
// test column with yes/no is col 14 or N
var ss = SpreadsheetApp.openById(“10_d4Drmj27cIOdTrnWfWXiZRd9bJRdmClnj-AbXHtQc”);
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if(s.getName() == “KOLOM AVAILABLE AXIS” && r.getColumn() == 14 && r.getValue() == “ONLINE”) {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName(“KOLOM ONLINE”);
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
}
}

i don’t have any knowledge in coding (and yes i kinda “steal” these codes from google spreadsheet forum :D)

can someone help me please?

Hi @Nicky_Mad

You may want to add a trigger to your script.

Then run it manually, in order to “provoke” the access granting protocol.

i did create a trigger “onChange”

the problem is, when i close my spreadsheet (like close the browser and just open the appsheet), the script wont work

edit : The execution log said “completed” but nothing moved (means the script is not working)

more edit : Please help me :frowning:

1 Like