Auto-Convert Google Doc to PDF on Every Edit

When a document needs a fresh PDF every time it changes, an onEdit-style trigger eliminates the manual export step entirely.

Installing a Drive onChange trigger

Apps Script's onChange Drive trigger fires when any file in a user's Drive changes. Install it with ScriptApp.newTrigger('yourFunction').forUserCalendar() or use the Triggers panel. The trigger passes an event object with the change type and file ID so you can filter for edit events only.

Filtering for the right file

The onChange trigger fires for all changes in Drive, not just the document you care about. Check the event's fileId property against your target document ID and return early if it does not match. This keeps the function fast and avoids unnecessary API calls.

Debounce logic

Google Docs sends multiple save events per editing session. Without a debounce, the trigger fires dozens of times per hour during active editing. Store the last conversion timestamp in PropertiesService and skip a new conversion if less than five minutes have passed since the last one.

Frequently Asked Questions

Can I use a simple onEdit trigger instead of a Drive trigger?

Simple onEdit triggers only work inside Google Sheets, not Google Docs. For Docs, you need an installable Drive onChange trigger.

Ready to Try It?

Install the free Chrome extension and start converting your Google Docs to PDF in one click.

Install Free Extension