📆 Sync Toggl time entries to Google Calendar events on Google Apps Script
- Build this script, which will generate
dist/bundle.js
.npm install npm run build
- Upload
dist/index.js
anddist/bundle.js
to Google Apps Script.
If you're using @google/clasp, editscriptId
property in.clasp.json
and runnpm run deploy
. - Set
CALENDAR_ID
andTOGGL_API_TOKEN
script properties. - Create a Time-driven trigger to run
main
function periodically (e.g. every hour).
CALENDAR_ID
(required) - your Google Calendar IDTOGGL_API_TOKEN
(required) - your Toggl API tokenSYNC_PERIOD_IN_DAYS
(optional, default:7
) - Toggl time entries in this period are synced to Google Calendar.
- Retrieve Toggl time entries and Google Calendar events in the past
SYNC_PERIOD_IN_DAYS
days - For each Toggl time entry, create a corresponding Calendar event or update the corresponding Calendar event if it changed.
Due to Toggl API and current implementation, there are 2 limitations:
- Time entries lasting beyond
SYNC_PERIOD_IN_DAYS
days are not synced. - If there are more than 1000 time entries in the past
SYNC_PERIOD_IN_DAYS
days, some time entries may not be synced.
- automate with Zapier or Integromat
- cons: the number of executions per month are limited on the free plan (100 tasks on Zapier and 1000 operations on Integromat).
- Toggl iCal integration
- cons: need to upgrade to the starter plan of Toggl.