Skip to main content

I’m looking to create a zap that runs at the end of each month (say, the 24th) and creates 6 notion database entries. These database entries need a date entry (so it works as a calendar). These 6 dates need to be non-weekend and non-holiday days.

I’ve managed to work out how to essentially do this:

  1. trigger scheduler for the 24th of every month
  2. create notion event titled Day 1
  3. create notion event titled Day 2
  4. create notion event titled Day 3
  5. create notion event titled Day 4
  6. create notion event titled Day 5
  7. create notion event titled Day 6
  8. format the date from step 1 as YYYY-MM-01 (so that it is the FIRST day of the month)
  9. format that date as ddd
  10. format the date as YYYY
  11. use a holiday list API that pulls the year from step 4 to create a list of days that are federal holidays as YYYY-MM-DD
  12. Weekend or Holiday?
    1. if date contains Sun or Mon (from step 9) or is contained in holiday list (from step 11)
      1. format date from step 8 as YYYY-MM-DD +1 day
      2. RERUN step 12, essentially keep adding days until its neither a holiday or weekend.
    2. if date does not contain Sun and Mon (from step 3) and is not contained in holiday list (from step 5)
      1. change notion event “Day 1” to have this date
      2. take this date +1 day and RERUN step 12 until it hits 6 notion entries

 

And this is about where it gets fuzzy. I’m sure there’s a way to loop this or sub-zap, but I’m pulling my hair out here. I know I need it to incrementally go up in both date and notion database entry- so if 10/1 is put into notion entry 1, 10/2 wont overwrite notion entry 1 and instead update notion entry 2.

 

Any ideas or suggestions would be greatly appreciated.

Hi @evep 

Good question.

Generally that type of custom logic involves custom Code.

App: Code https://zapier.com/apps/code/help

Try asking ChatGPT for help writing the custom code.

Or you can hire a Certified Zapier Expert.