Reputation: 11
Does anyone know if I have to have my google sheet open for the onEdit()
function to work? I have a background task running that edits the sheet but my function only fires when I manually open the sheet and make an edit real time. Sheets recognizes when my edits are made (both manually and in the background) but my function won't work unless I have it open.
My function pings a url:
function onEdit() {
UrlFetchApp.fetch("https://nosnch.in/tokenhere");
}
If sheets won't run the function when the sheet isn't opened is there any way around this?
Upvotes: 1
Views: 634
Reputation: 4034
onEdit is a UI triggered function.
You can have the offline background task call onEdit()
directly as it concludes if it is within the same script
function backgroundTask() {
// do stuff
onEdit();
}
If it is in another script you'll need to call it either as a webapp or library tie-in.
Upvotes: 3