Skip to main content

Analyze contract risk from Google Drive with OpenAI and log to Gmail & Sheets

Workflow preview

Workflow preview
100%
Analyze contract risk from Google Drive with OpenAI and log to Gmail & Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

How it works This workflow automates end to end contract analysis when a new file is uploaded to Google Drive. It downloads the contract, extracts its content, and uses AI to analyze legal terms, o...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googledrive, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.if, n8n-nodes-base.gmail, n8n-nodes-base.googledrivetrigger, n8n-nodes-base.googlesheets, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Avkash Kakdiya.

Original n8n.io source

1.1 Workflow description

Title
Analyze contract risk from Google Drive with OpenAI and log to Gmail & Sheets
Workflow name
Analyze contract risk from Google Drive with OpenAI and log to Gmail & Sheets

How it works

This workflow automates end-to-end contract analysis when a new file is uploaded to Google Drive. It downloads the contract, extracts its content, and uses AI to analyze legal terms, obligations, and risks. Based on the assessed risk level, it notifies stakeholders and logs structured results into Google Sheets for audit and compliance.

Step-by-step

  • Step 1: Contract ingestion and AI analysis

    • Google Drive Trigger – Monitors a specific folder for newly uploaded contract files.
    • Download file – Downloads the uploaded contract from Google Drive.
    • Extract Text From Downloaded File – Extracts readable text or prepares raw content for complex files.
    • AI Contract Analysis – Analyzes legal, commercial, and financial clauses using AI.
    • Format AI Output – Parses and structures the AI response into clean, usable fields.
  • Step 2: Risk alerts and audit logging

    • Alert Teams Automatically – Evaluates risk level and checks for significant risks.
    • Send a message (Risk Alert) – Sends a detailed alert email for medium-risk contracts.
    • Send a message (Info Only) – Sends an informational email when no action is required.
    • Get The Data To Save In Google Sheet (Alert Path) – Prepares alert-related contract data.
    • Get The Data To Save In Google Sheet (Info Path) – Prepares non-alert contract data.
    • Append row in sheet – Stores contract details, risks, and timestamps in Google Sheets.

Why use this?

  • Eliminates manual contract screening and repetitive reviews.
  • Detects explicit and inferred risks consistently using AI.
  • Automatically alerts teams only when attention is required.
  • Creates a centralized audit log for compliance and reporting.
  • Scales contract analysis without increasing legal workload.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Download file1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 2 - Extract Text From Downloaded File1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - AI Contract Analysis1

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 2.1

Block 4 - Format AI Output1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - Alert Teams Automatically1

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 6 - Send a message2

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.2

Block 7 - Get The Data To Save In google Sheet2

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Send a message3

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.2

Block 9 - Get The Data To Save In google Sheet3

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Google Drive Trigger1

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 11 - Append row in sheet1

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Analyze contract risk from Google Drive with OpenAI and log to Gmail & Sheets
Complexity intermediate
Nodes 14
Categories Document Extraction, AI Summarization
Author Avkash Kakdiya
Published 08 Jan 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/12575/12575.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Analyze contract risk from Google Drive with OpenAI and log to Gmail & Sheets do?

How it works This workflow automates end to end contract analysis when a new file is uploaded to Google Drive. It downloads the contract, extracts its content, and uses AI to analyze legal terms, o...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.