I would like to create a template that creates a monthly note with a bulleted list for the days of the week.
What I’m trying to do
The note would look like this
2/1
2/2
2/5
… and so one for the rest of the month.
I have searched and have not come across anything that does this.
flobe20
February 9, 2024, 10:36pm
2
I figured out a solution to this using Python.
Using the plugin Python Scripter and the following Python code
import calendar
from datetime import datetime
year = datetime.now().year
month = datetime.now().month
month_name = calendar.month_name[month]
num_days = calendar.monthrange(year, month)[1]
path = "path/to/obsidian/vault/Monthly Work Notes"
file_name = f'{path}/{month_name} {year}.md'
with open(file_name, "w") as file:
for day in range(1, num_days + 1):
date = datetime(year, month, day)
day_of_week = date.strftime("%A")
if day_of_week != 'Saturday' and day_of_week != 'Sunday':
file.write(f"- #### {date.strftime('%m/%d')}\n")
I am filtering out Saturday and Sunday since I am using this for work related notes.
Another option is the Periodic Notes plugin, which supports monthly notes and supports date math in templates (so you can lay out the whole month of days at once).
system
Closed
May 11, 2024, 5:18am
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.