Document Analysis and PDF Summarization using Mistral AI and OneDrive - n8n Workflow

Automate deep PDF analysis across nested OneDrive folders using this advanced n8n workflow. It extracts text, summarizes documents with Mistral AI, and stores structured data in an n8n Data Table.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Organizations needing automated extraction and summarization of documents stored in Microsoft OneDrive.
Users managing large repositories of PDF files who want structured data (dates, locations, key findings) extracted instantly.
Technical specialists looking for sophisticated n8n templates integrating cloud storage, PDF processing, and advanced LLM chains.
Automation experts requiring a robust n8n workflow for multi-level folder traversal and conditional processing.

Overview

This powerful n8n workflow is designed to solve the challenge of automatically processing unstructured data locked within documents spread across deeply nested folder structures in OneDrive. By leveraging the flexibility of the n8n platform, this solution first scans up to eight levels of subfolders for new PDF documents. It then intelligently filters out files that have already been processed and those exceeding a 10MB size limit. The core value lies in the subsequent AI pipeline: downloaded PDFs are parsed, and the extracted text is fed into a Mistral AI model via the LangChain n8n node, which performs two critical tasks: generating a concise, markdown-formatted executive summary and extracting structured metadata (dates, locations, key personnel). Finally, this rich, structured information is automatically mapped and inserted into an n8n Data Table, creating a searchable, organized repository of document insights. This complex n8n template transforms cloud storage into an intelligent, actionable knowledge base, optimizing productivity by handling tedious document review.

How it Works

The execution of this n8n workflow is initiated by the Schedule Trigger1 n8n trigger, set to run daily at 8:00 PM.


  1. Initialization & Deduplication: The n8n workflow starts by searching OneDrive for the designated main folder and simultaneously retrieves a list of previously analyzed files from the n8n Data Table using the Get row(s) n8n node.

  2. Deep Folder Scan: A chain of eight sequential Get items in a folder n8n node instances recursively scans up to eight levels of subfolders within the main OneDrive folder.

  3. PDF Identification & Merge: After each folder scan, an If PDF X n8n node filters the results, ensuring only documents with the application/pdf MIME type proceed. All valid results are then combined using the Merge n8n node.

  4. Filtering New Files: The combined list of all PDFs is passed to the Compare Datasets n8n node, which filters out files already present in the Data Table, guaranteeing the n8n workflow only processes unique, new documents.

  5. Preparation and Check: New files are processed through Set File ID nodes to create useful path and file name variables. The If Size n8n node ensures files are under the 10MB limit to prevent oversized data from overwhelming the LLM service.

  6. AI Processing Loop: For each new, validated PDF:

The Download file n8n node retrieves the document from OneDrive.
The Extract PDF Text n8n node converts the binary PDF into raw text data.
* The text is sent to two parallel AI processing chains utilizing the Mistral AI n8n node: one chain focuses on generating a high-level Overview (Summary, Key Findings, Scope), and the second focuses on structured Document Information (Date, Location, Personnel).

  1. Structured Output: Structured Output Parser n8n nodes ensure the AI output is strictly converted into predictable JSON objects.

  2. Storage: The aggregated, structured data is mapped precisely and written as a new row into the target n8n Data Table using the Insert row n8n node, completing this automated n8n workflow cycle.

Installation Guide

To use this sophisticated n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and import it into your n8n instance as a new n8n workflow.

  2. Credentials Setup:

Set up your Microsoft OneDrive credential for the file operation n8n nodes (Search for Main Folder, Get items in a folder, and Download file).
Configure your Mistral Cloud credential for the Mistral Cloud Chat Model n8n node.
* Ensure the Get row(s) and Insert row n8n nodes are connected to a running n8n Data Table.

  1. Data Table Setup: A Data Table must exist with the columns mapped in the Insert row n8n node: Summary, KeyFindings, Scope, Date, Location, FileName, and Path. The table ID reference in the n8n node must be updated to match your new Data Table.

  2. Main Folder Configuration: Update the Search for Main Folder n8n node and set the exact name of the OneDrive folder you wish to scan (currently set to 'PdM Test Folder').

  3. Activation: Once all credentials and settings are configured, activate the n8n workflow. It will execute according to the schedule defined in the n8n trigger.

Node Details

Schedule Trigger (n8n trigger): Initiates the n8n workflow run daily at 20:00 (8 PM).
Microsoft OneDrive n8n node: Manages all file operations, including searching for the main directory, traversing up to eight levels of nested subfolders, and performing the Download file operation.
Data Table n8n node: Used as the database layer. Get row(s) retrieves analyzed file paths for deduplication, and Insert row stores the final AI-extracted summary data, utilizing dynamic expressions for mapping.
If n8n node: Performs conditional routing. Filters files based on MIME type (application/pdf) and uses If Size to block files over 10MB from proceeding to the LLM pipeline.
Compare Datasets n8n node: Compares the newly found PDFs against the list retrieved from the Data Table, ensuring the n8n workflow only processes documents that have not been analyzed yet.
Extract PDF Text n8n node: Converts the binary PDF file content downloaded from OneDrive into readable text that can be consumed by the AI models.
Mistral Cloud Chat Model n8n node: The core LLM provider. Uses the mistral-small-latest model for complex document summarization and key data extraction within this n8n template.
Agent n8n node (Overview, Document Information): Configures specific AI personalities (like the 'Document Review Specialist AI') using detailed system messages and constraints to guide the Mistral LLM in producing highly structured, analytical outputs. This is a critical LangChain n8n node component.


  • Structured Output Parser n8n node: Validates and reformats the output from the AI agents into specific, defined JSON schemas, ensuring data consistency before insertion into the n8n Data Table.

Related n8n Workflows

Paid

Nodes: 15 Nodes
Updated: December 26 2025
View all
Created by
Jordan Hoyle
Jordan Hoyle

Featured*