Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
4 of 6
added 143 characters in body

Trigger function when IMPORTRANGE() is updated

I have a sheet (sheet-A) that gets it's information from another sheet (sheet-B) using IMPORTRANGE(). In sheet-B I have a function that formats cells based on the a value in the row. At the moment I run this function on a timer because IMPORTRANGE() does not trigger an OnEdit or OnChange events.

I am wondering if there is some other mechanism to trigger an event on sheet-B from sheet-A so that I can run the function on demand1 and not every minute. During some times I may need to run the function every few seconds, and I'd like to keep the formatting somewhat interactive, other times the sheet may not be in use for weeks and I don't need to run the function every minute.

1: By "on demand" I mean to run my function when the value of a sheet from an external spreadsheet file changes.

In other words, I'm looking to automate the trigger of the function. For example in my case the user does not have access to the UI when viewing sheet-B and they are editing sheet-A from another machine. In my case the only way I have found to make this work is by using the time based trigger.

I looked at simple and installable trigger official documentation some time ago, as I said I'm using a simple time based trigger that runs every minute right now. I'm sure I also looked at installable triggers as well but unfortunately one of their restrictions is they do not run if a file is opened in read-only (view or comment) mode.

  • 163
  • 2
  • 8