logoalt Hacker News

xd1936yesterday at 9:04 PM1 replyview on HN

There are several ways to get all events for the day! The easiest one in my experience has been to write a simple Apps Script project and expose that as a published Web App[1]. That moves all of the oAuth logic and Calendar API plumbing to Google's server-side code, and gives you a simple long URL that contains exactly what data you want.

Something like:

```

function doGet(req) {

  let start = new Date();

  start.setHours(12,0,0,0);

  let end = new Date(start);

  end.setDate(end.getDate() + 3);

  let events = CalendarApp.getEvents(start, end);

  return ContentService.createTextOutput(events.map(x => x.getTitle()));
}

```

1. https://developers.google.com/apps-script/guides/web


Replies

IshKebabyesterday at 9:55 PM

Ooo sweet, thanks for the hint!