Adding your google calendar agenda to your daily journal

FYI, I tried to parse and include ${e.calendar} on my mac, it worked with that parser.

Can you share the output of a few lines of

powershell  (C:/Users/adminuser/AppData/Local/Programs/Python/Python37-32/Scripts/gcalcli --nocolor agenda --details all --tsv --nodeclined)

Maybe on Windows the tab separated values are coming in a different order? (Unlikely, but I am having trouble coming up with plausible explanations). I’ll try to spin up my Windows laptop this weekend and check things out there too if we don’t figure out before then.

This was the Javascript library I was eyeing. We don’t need much, it’s more the hassle of client / secret IDs for each of us that makes this unwieldy.

Sorry for the delay.

Here is what I get :

What would be needed to make it work? Or how can we make it work?
Using javascript would be great. It would probably make it less buggy and at the same time it even could become compatible with the mobile version as well.

1 Like

I second this. A plugin request then? For generating daily agenda as task lists and weekly agenda (can be viewed as a kanban using a cssclass).

1 Like

Agreed that a plugin would be much better than this experience.

The OAuth token refresh / storage is what makes it unlikely for me to tackle. Based on past experience there’s far more work to make authentication work than there will be to parse the results and convert them to a daily agenda that would be Day Planner compatible.

There’s been talk in the #plugin-dev discord channel about this. I’ll keep an eye out and if someone tackles it in a way I can reuse, I’ll give it a try.

Okay, thank you for your answer and your help so far anyway.
Fingers crossed someone will have the time and courage to create a google calendar plugin or solve the OAuth token refresh/storage complexity!

2 Likes

Hi @muness . Thank you for your wonderful code and templater use for the google calendar! How can I update the template to remove the header in the output? Right now I’m getting the following:

  • [ ] start_time title link
  • [ ] 10:00 test event link

and I’d like to remove that first line.

Thank you in advance!

1 Like

Strange, am not seeing that header despite heavy use.

Maybe it’s because I am filtering for a specific calendar:

agenda = agenda.filter((e,i) => e.calendar == "muness.castle@<work_domain>.com" )

Maybe something like that would work? In other words, use:

tR += agenda.map(e => { return - [ ] ${e.calendar} ${e.startTime} ${e.title} ${e.meetingUrlOrLocation}}).join('\n')

To see what the value of the header entry calendar is, then remove it using a filter:

agenda = agenda.filter((e,i) => e.calendar != "<calendar value in header>" )

Thank you for the suggestions.

I added the filter for a specific calendar and the header did disappear. However, the first event for that day also disappeared. :face_with_hand_over_mouth:

When I include calendar in the output I get the following for the header:

and filtering the agenda to exclude “calendar” didn’t have any effect.

I am working in Windows 10 - do you think that has any impact on this?

What was your filter? Something like:

agenda = agenda.filter((e,i) => e.calendar != "calendar" )

I installed gcalcli on my Windows 10 machine to check. I don’t see a header row. What is the user function definition you’re using in your Templater configuration?

Here’s what I found to work for me:

powershell (C:/Users/munes/AppData/Local/Programs/Python/Python39/Scripts/gcalcli --nocolor agenda --details all --tsv --nodeclined '%from%' '%to%')

yes that is the filter i tried

Ok. I don’t know why but I think I got it fixed.

When I tried this originally from your script I had difficulty returning the location so I tweaked it and I was able to get the results I wanted - except for the additional header.

So this time I used your original template script but i had to add “id: props[0]” to the return and renumber the other items. I noticed the results included that extra value when i tested the powershell call to gcalcli.

<%*
function parseAgendaTsv(agenda) {
return agenda.split(“\n”).map(event => {
let props = event.split(“\t”)
// gcalcli handlers
return ({id: props[0],
startDate: props[1],
startTime: props[2],
endDate: props[3],
endTime: props[4],
calendarUrl: props[5],
notSure5: props[6],
conferenceType: props[7],
conferenceUrl: props[8],
title: props[9],
location: props[10],
description: props[11],
calendar: props[12],
meetingUrlOrLocation: props[6] == “video” ? props[7] : props[9],
raw: event,
})
})
}

i did need to filter the agenda for my calendar to remove the header.
agenda = agenda.filter((e,i) => e.calendar == “[email protected]” )

1 Like

Yay, finally got some time to hack on the gcalcli-less solution: muness/obsidian-ics: Generate Daily Planner from one or more ical feeds (github.com)

It only supports a single ics right now, and presumes a Daily Planner format.

  1. from Google Calendar, look for the calendar in the left sidebar click the vertical … menu, Settings and Sharing, Integrate calendar, Copy the Secret address in iCal format
  2. enter that URL into settings
  3. go to a daily note, use the ICS: Import events command
4 Likes

I copied main, manifest, and styles into the plugins folder, but the plugin will not activate. What am I missing? Does it need a data.json file?

I think it’s main.ts, right? You need to compile to javascript first. So you will probably need tsconfig.json. Also I think he imports some typescript from a folder as well. So you will probably just want to download the entire repository, install dependencies with “npm install” and compile with “npm run build”. Not sure though. Can’t really look into it that much right now.

@muness you rock!
If you can get this to do more than one ics, I will buy you a case… of coffees!

1 Like

I ran “npm run build” and it created main.js, but I really don’t know what to do from there. Looks like I’ll have to wait for @muness to publish it…

While I figure out how to release this (am new to obsidian plugins, apologies for the delay), the easiest way to get it working for now is to use obsidian-tools/packages/obsidian-plugin-cli at main · obsidian-tools/obsidian-tools (github.com) to build it and install it into your vault.

  1. Clone the repo & cd into it
  2. Install the plugin tools: npm install -g obsidian-plugin-cli
  3. npm dev . which will build the plugin and ask you which vault to install it into.

I am hoping to have a release shortly, just having trouble with including the npm dependencies in the build when I build the plugin using GitHub Actions.

4 Likes