See llms.txt for all machine-readable content.

Back to Templates

Track contract renewals from Drive PDFs with Gemini, Sheets, Gmail and Slack

Quick overview

This workflow scans a Google Drive folder of contract PDFs on a weekly schedule, extracts key renewal terms from new documents using the Gemini API, stores and updates a contract registry in Google Sheets, and sends renewal alerts via Gmail and Slack plus a weekly digest email.

How it works

  1. Runs weekly (or manually for testing) and loads configuration values like Drive folder ID, Google Sheet ID, alert email, and Slack channel.
  2. Searches Google Drive for PDFs in the target folder and reads the current contract registry from Google Sheets.
  3. Compares Drive files to the registry to identify new contracts, then downloads each new PDF, extracts its text, and calls the Gemini API to extract structured contract terms.
  4. Appends extracted contract records to the Google Sheets Registry and combines new and existing contracts into a single list.
  5. Calculates days-to-renewal and assigns urgency tiers (90/60/30/notice_passed) with risk flags for short-notice auto-renewals, then filters contracts that have entered a new alert tier since the last run.
  6. For each alert due, builds a one-page renewal briefing, emails it via Gmail, posts a Slack notification, and updates the registry to record the last alerted tier.
  7. Builds a portfolio summary of tracked contracts, new contracts, alerts sent, and items needing review, emails the weekly digest via Gmail, and logs the run to a RunLog sheet in Google Sheets.

Setup

  1. Create a Google Sheet with a Registry tab containing columns: file_id, vendor_name, contract_title, start_date, end_date, auto_renewal, notice_period_days, annual_value, currency, termination_penalty, key_contact, last_alert_tier, status, added_date, and a RunLog tab with date, contracts_scanned, new_contracts, alerts_sent.
  2. Add Google Drive, Google Sheets, Gmail, and Slack credentials in n8n, and set a Slack channel to receive renewal notifications.
  3. Get a Gemini API key (Google AI Studio) and fill in the Workflow Configuration values for geminiApiKey, driveFolderId, registrySheetId, alertEmail, slackChannelId, and maxCharsPerContract.
  4. Put your contract PDFs into the configured Google Drive folder and run the workflow once manually to populate the registry and validate alerts and digest emails.