Sai Krishna
Sai Krishna

Reputation: 135

Triggers on specific time in google sheets

I want to execute a code at 7.00 PM daily in Google Sheets. I created trigger but it is executing at 7.58 PM daily.

function Work_Flow_Trigger() {
ScriptApp.newTrigger("Work_Flow")
            .timeBased()
            .atHour(19)
            .nearMinute(00)
            .everyDays(1)
            .create();
}

Upvotes: 1

Views: 2498

Answers (2)

mtelis
mtelis

Reputation: 674

nearMinute() is not exact, it's plus/minus 15 minutes (please refer to API documentation here.

If you need to be more precise you have to use everyMinutes(1) and add a code to run target function once you reach desired point in time.

Upvotes: 1

user11935585
user11935585

Reputation:

Try this:

function Work_Flow_Trigger() {
ScriptApp.newTrigger("Work_Flow")
            .timeBased()
            .atHour(18)
            .nearMinute(02)
            .everyDays(1)
            .create();
}

Upvotes: 0

Related Questions