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.
Related Templates
Send structured logs to BetterStack from any workflow using HTTP Request
Send structured logs to BetterStack from any workflow using HTTP Request Who is this for? This workflow is perfect for...
Provide latest euro exchange rates from European Central Bank via Webhook
What is this workflow doing? This simple workflow is pulling the latest Euro foreign exchange reference rates from the E...
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
๐ Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments