Summarize Daily Notes Using Dataview

Thanks @AlanG – This is a gift that keeps on giving. Just started working with it and it works like a charm.

One question, in the YMAL header, I set a datapoint to distinguish between the kind of notes e.g. “type: morning journal”, “type: evening journal”. Do you know how I can include this into the data view query to be independent of my folder structure?


thank you so much for this snipped. that was what I was looking for

1 Like

Version returning the table instead of paragraphs. Thanks @dustin

const header = '#+ [^\\n]*?Tester[^\\n]*?'

// You can update this to filter as you like - filtering for just your daily notes would be good
const pages = dv.pages('#daily').sort(x =>, 'desc')

// This regex will return text from the Summary header, until it reaches
// the next header, a horizontal line, or the end of the file
const regex = new RegExp(`\n${header}\r?\n(.*?)(\n#+ |\n---|$)`, 'is')

const summaries = []

for (const page of pages) {
    const file = app.vault.getAbstractFileByPath(page.file.path)
    // Read the file contents
    const contents = await
    // Extract the summary via regex
    const summary = contents.match(regex)
    if (summary && summary[1].trim()) {
		summaries.push([`[[${file.basename}]]`, summary[1].trim()]);

dv.table(["Note", "Description"], summaries)
1 Like