首页 > 解决方案 > 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();
}

标签: javascriptgoogle-apps-scriptgoogle-sheetstriggers

解决方案


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.


推荐阅读