1

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?

2
  • Yes. You must have the sheet open for an edit to trigger it. Commented Feb 17, 2015 at 17:42
  • Also, you cannot send emails or fetch pages inside the onEdit trigger. Commented Feb 18, 2015 at 9:56

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.