0

I have a Google Sheets spreadsheet. I would like to save sheet information in different sheets based on time such as 9:30 am, 9:45 am, 10:00 am ... 12:00pm.

I have seen an hourly time-based trigger, but could not use the specific time-based trigger.

How can I apply this hour and minutes based trigger?

Swarnali
  • 1
  • 1
  • You need to first write the function that you want to execute in an Apps Script project, and then set up a time-drive trigger to execute that specific function. Have you written the function to "save sheets information in *different sheets*"? – Aerials Aug 10 '20 at 14:09

1 Answers1

0

You can trigger each 15 min. If you want to trigger each 15 min but only in between 9:30am and 12pm you can use the 15 min trigger and check the datetime before executing your main function.

You can check if your time is inside the range using this snippet from RobG answer at How to check time between range using javascript:

var range = ['09:30','12:00'];
    
function isInRange(value, range) {
   return value >= range[0] && value <= range[1];
}
    
var date = new Date();
var currentTime = date.getHours + ':' + date.getMinutes;

if(isInRange(currentTime ,range)){
  mainFunction();
}

I didn't test this, but it should give you the idea. Note that 'new Date()' will get the time information based on the server time.

Eduardo Conte
  • 1,145
  • 11
  • 18