Photo by Cathryn Lavery on Unsplash

Each first Monday of the month

automatically generated via an automation

Christiaan Huizer
4 min readJan 7, 2023

--

In this blog I explain how to add each first Monday of the month a new row to a table. It is based on a question in the community. The response given felt almost self evident for me, but when I looked at it again, I noticed that I left out a part of the solution when you are not familiar with automations.

In this blog I write about two steps to make sure you can set up your own automation properly.

  • First we develop the code in Coda
  • Next we set up the automation

Step 01 — the coding part

Below the solution I created:

suggested solution

It does a few things. Every day there is a new list generated for about a year based on Today() + 365 and it results in 12 dates corresponding to the 12 Mondays. We don’t need all these dates, only one every month. I’ll come back to that later.

The first part of the filter takes out all dates that correspond with the weekday name Monday. Each year you have about 52 of these dates — some years have 53 weeks.

The second part of the filter reduces the list by asking for a Monday that is on day 1 up to 7. I have a strong preference for the Contains() function in most of my formulas and here you see why. It can contain lists, here the list of seven days.

The last part is eye candy, we turn the date numbers into dates via the ForEach() .

To prepare for the automation we only need one date at the time. We can do this in various ways. In an earlier blog I solved if by taking the first date with a positive value compared to the date of Today()

Ín this blog we follow maybe a slightly better approach. We simply limit the date range by adding 31 to Today() and this results in only one date in the example below, but maybe there are cases that we find two dates when the month has less than 31 days (like feb) and the Mondays are early in the month, we therefor add First() to the end.

The outcome is the value to check for

When I am writing this, shortly after Three Kings in 2023, the next date is Feb 06, 2023. The next automation should run on this date.

Step 02 — the automation part

How to configure the automation in such a way that only a row is added the first Monday of each month? Below the basics. We have a table named ‘AutoMatic Monday’ and an automation rule that runs every day at 09:00 AM CET. This you can easily put later or earlier. It is important that the automation runs each day

the basics

In the Then part we select add Row and select the target table.

The crucial part is however the conditional part. Here we add this rule.

Once the day of today corresponds with the function we wrote, the condition is met and the add row function becomes active. This only happens 12 times a year, but the automation checks every day.

Below how this looks inside the automation, you activate the rule and off you go!

the condition in the automation taking care of the first Monday each month

I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. Besides you find my (for free) contributions to the Coda Community and on Twitter.

My name is Christiaan and I support SMB with calculations (budgets and planning) and I prefer using Coda to get the job done.

Coda comes with a set of building blocks ー like pages for infinite depth, tables that talk to each other, and buttons that take action inside or outside your doc ーso anyone can make a doc as powerful as an app (source).

Not to forget: the Coda Community provides great insights for free once you add a sample doc.

Christiaan — Coda Expert — on: “Each first Monday of the month”

If you enjoyed this read and would like to get more Coda related content, please consider a Medium membership. It is it only $5 a month, and you’ll have access to every article ever published on Medium. If you sign up using my referral link, I’ll earn a small commission.

--

--

Christiaan Huizer

I write about how to Coda . You find blogs for beginners and experienced makers. I publish about 1 / week. Welcome!