📆 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.jsanddist/bundle.jsto Google Apps Script.
If you're using @google/clasp, editscriptIdproperty in.clasp.jsonand runnpm run deploy. - Set
CALENDAR_IDandTOGGL_API_TOKENscript properties. - Create a Time-driven trigger to run
mainfunction 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_DAYSdays - 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_DAYSdays are not synced. - If there are more than 1000 time entries in the past
SYNC_PERIOD_IN_DAYSdays, 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.