Set workflow to run for a specific duration a week

Hi all, I am trying to trigger a workflow or add an If condition to submit data to an api only during certain times of the week.

NOTE: I have a Cron that does every 1 minute check for a Google sheet at the start of the workflow, then I want to submit the data only during the above times.

Example of the timeline is:

GMT time
Monday - Thursday - 10:00 - 22:00
GMT time
Friday - 10:00 - 14:00

I want to continue the workflow only during the above durations.

Any help on this one with n8n. Thanks!

Hey @zocket,

What about just using cron for the times you want or is the workflow doing a bit more and it is only one small part you don’t want to trigger?

The cron node currently polls the sheet every 1 minutes, so am just wondering how to add the other conditions for the timeline like 10am to 10pm , Monday to Thursday. If the time isn’t in that duration, the workflow shouldn’t continue.

You can do that with a custom cron expression. To build the expression you can use the crontab.guru.

2 Likes

That is exactly what I was thinking, have 2 cron schedules one for Mon - Thur and one just for Fri.

Just depends on if the rest of the workflow needs to actually run outside of those hours.

2 Likes

Thanks @jon and @RicardoE105.

I actually didn’t know the Cron could have that expression I needed. Thanks so much!

More to learn while using n8n :slight_smile:

3 Likes

Cron can be very powerful for schedules and you can always have multiple cron entries if needed to cover off anything really odd.

1 Like