View Upcoming Google Calendar Events via the Terminal
1 min readFeb 24, 2025
Keep it simple and don’t miss anything important!
Here’s how to list upcoming Google Calendar events in your terminal:
- Install Python
- Install gcalcli via “pip install gcalcli” or consult the README
- Run “gcalcli” and set up your access token
- Run the following script. The list of events will update itself every five minutes.
#!/bin/bash
# 1. Install Python
# 2. pip install gcalcli
# 3. get an access token
# Exit on any error
set -e
# Handle SIGINT (Ctrl+C) and SIGTERM
cleanup() {
echo
echo "Calendar check script terminated."
exit 0
}
trap cleanup SIGINT SIGTERM
# Check if gcalcli is installed
if ! command -v gcalcli &> /dev/null; then
echo "Error: gcalcli is not installed. Please install it first."
echo "You can install it using: pip install gcalcli"
exit 1
fi
echo "Starting calendar check script (checking every 5 minutes)"
echo "Press Ctrl+C to exit"
echo
while true; do
clear
echo "=== Calendar Check: $(date) ==="
echo "Fetching upcoming events..."
echo
if ! gcalcli agenda --nostarted --nodeclined; then
echo "Error: Failed to fetch calendar events"
sleep 300 # Still wait 5 minutes before retrying
continue
fi
echo
sleep 300 # Wait for 5 minutes
done