Using Google Drive Triggers for PDF Automation
Apps Script's installable Drive triggers give you fine-grained control over when PDF conversion happens. This guide explains the trigger types, how to install them, and how to use the event data to make smart conversion decisions.
Types of Drive triggers
The main Drive trigger type is onChange, which fires on create, edit, move, copy, and trash events. You can install it for a user's entire Drive or for a specific folder. The trigger passes an event object with the change type, file ID, and other metadata.
Installing a trigger programmatically
Use ScriptApp.newTrigger('functionName').forDrive().onChange().create() to install a trigger from within a script. This is useful when you want to install the trigger as part of a setup function rather than manually through the Triggers UI.
Working with the event object
The event object passed to your onChange handler has two key properties: changeType (create, edit, move, remove, or trash) and fileId. Use these to decide whether to run the conversion. Log unknown change types during development to understand the full range of events your trigger receives.
Frequently Asked Questions
Do Drive triggers require a paid Google Workspace account?
No. Installable Drive triggers are available on personal Google accounts and all Workspace tiers.
How many Drive triggers can I install?
Apps Script imposes a limit on the number of triggers per user and per project. The current limits are documented in Google's Apps Script quotas page.
Related article
Set up a workflow to convert Google Docs to PDF →Ready to Try It?
Install the free Chrome extension and start converting your Google Docs to PDF in one click.
Install Free Extension