0

I'm using two Google sheets lets say sheet A (main data) and B.

Sheet B retrieve data from sheet A using importrange and query functions and data should refresh every day at 7:30 am. There is a problem in Google sheet that data is not refreshing continuously and some lags in between. If I create a trigger in App script of the main reference sheet A , like this:

function refreshA() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("A");
  sheet.refresh();
}

function setupTriggers() {
  ScriptApp.newTrigger("refreshA")
      .timeBased()
      .atHour(7)
      .atMinute(30)
      .everyDays(1)
      .create();
} 

Will this run if the page is not opened or not accessed. I mean will it run even if i didn't open Sheet A? Is there a difference if I used a built in Time driven trigger rather than an app script?

2
  • There is no refresh() method in the Sheet class. Make sure you are not asking an XY question. Commented Aug 16 at 13:50
  • Thanks, so what's the function that can refresh the page? Commented Aug 16 at 16:12

1 Answer 1

1

How to add a Google sheet time driven trigger that runs offline?

Apps Script runs on Google's servers, not in your computer. A time-driven trigger will fire at the time specified, regardless of whether there is a user at the keyboard.

Is there a difference if I used a built in Time driven trigger rather than an app script?

There is no "built in Time driven trigger" other than the one available in Apps Script. You can set up the trigger manually or programmatically, like your setupTriggers() function shows. The trigger will work the same regardless of how it was set up. To review installed triggers, open the script editor and click the clock 🕓 icon on the left.

See triggers.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.