Generate Word documents from scheduled data

Recipe ToolsMarketingDocument/FileUtilitiesDeveloper ToolSales Enablement

What it does

When the clock triggers every 5 minutes, this automation fetches a file and executes JavaScript to populate a Word template with dynamic data. The generated document uploads to Google Drive so someone can access it from their drive.

Who it's for

Operations teams who need to generate Word documents on a schedule without manual template updates.

How teams use this

Generate daily reports as Word docs

Create formatted Word documents every 5 minutes with the latest data, then store them in Google Drive for the team to review and share with stakeholders.

Populate contracts with client details

Use the Word template to automatically fill in client names, dates, and terms from a data source, then upload each contract to Google Drive for legal review. The template structure stays the same.

Add conditional sections to documents

Extend the JavaScript code to check conditions and only include certain sections in the Word document based on the data. For example, add payment terms only when the contract type is a service agreement.

Sync employee data into offer letters

Set up the Word template to pull employee names, titles, and start dates from a data source, then upload each offer letter to Google Drive for HR to send. Only the data source changes between runs.

How it works

  1. Run on a 5-minute schedule. The automation starts every 5 minutes to check for new data and begin the document generation process.
  2. Retrieve file from link. File connector fetches the source document needed to populate the Word template with current information and dynamic values.
  3. Execute JavaScript code to merge data. Js Eval runs code that combines the fetched data into the Word document template, filling all placeholders with dynamic values from the source.
  4. Upload generated document to drive. Google Drive receives the completed Word document and stores it so someone can access, review, and download it whenever needed.