i want to Open google form every day at 00:01 and closed at 12:00
this is my Code
function createDailyTrigger() {
ScriptApp.newTrigger("openCloseFormTrigger")
.timeBased()
.everyDays(1)
.atHour(18)
.create();
}
function openCloseFormTrigger() {
const now = new Date();
const FORM_OPEN_DATE = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 1);
const FORM_CLOSE_DATE = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 12);
ScriptApp.newTrigger("openForm")
.timeBased()
.at(FORM_OPEN_DATE)
.create();
ScriptApp.newTrigger("closeForm")
.timeBased()
.at(FORM_CLOSE_DATE)
.create();
}
function openForm() {
var form = FormApp.getActiveForm();
form.setAcceptingResponses(true);
}
function closeForm() {
var form = FormApp.getActiveForm();
form.setAcceptingResponses(false);
}
Here My Execution Tab
if i save and run now, variable Vday is work fine but at 00:01 i must save and run again.
if i don't save and run at 00:01 , i cannot open google form ( according to the script I made, it can only be opened from 00:01 to 12:00 )
can this script run automatically ? without save and run at 00:01 ?