Analyze Legal Documents with GPT & o4-mini plus Gmail & Google Sheets

Description

This workflow lets you upload a PDF document and automatically analyze it with AI. It extracts the text, summarizes the content, flags key clauses or risks, and then delivers the results via Gmail while also storing them in Google Sheets for tracking.

Itโ€™s designed for legal, compliance, or contract review use cases, but can be adapted for any document analysis scenario. Test it here: PDF Document Assistant

๐Ÿ”น Instructions / Setup

Webhook Input

Upload a PDF document by sending it to the webhook URL.

Extract from File

The workflow extracts text from the uploaded PDF.

Pre-processing (Code Node)

Cleans and formats extracted text to remove unwanted line breaks or artifacts.

Basic LLM Chain (OpenAI)

Summarizes or restructures document content using OpenAI.

Adjust the prompt inside to fit your analysis needs (summary, risk flags, clause extraction).

Post-processing (Code Node)

Further structures the AI output into a clean format (JSON, HTML, or plain text).

AI Agent (OpenAI)

Runs deeper analysis, answers questions, and extracts insights.

Gmail

Sends the results to a recipient.

Configure Gmail credentials and set your recipient address.

Google Sheets

Appends results to a Google Sheet for record-keeping or audits.

Respond to Webhook

Sends a quick acknowledgment back to confirm the document was received.

๐Ÿ”น Credentials Needed

OpenAI API key (for Chat Model + Agent)

Gmail account (OAuth2)

Google Sheets account (OAuth2)

๐Ÿ”น Example Use Case

Upload a contract PDF โ†’ workflow extracts clauses โ†’ AI flags risky terms โ†’ Gmail sends formatted summary โ†’ results stored in Google Sheets.

0
Downloads
0
Views
8.51
Quality Score
intermediate
Complexity
Created:9/10/2025
Updated:10/21/2025

๐Ÿ”’ Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments