Timesheet Data Extraction with Mistral AI OCR and Gmail Human Verification Loop - n8n Workflow

Automate timesheet processing using this advanced n8n workflow. It combines Google Drive file handling, multimodal OCR (Mistral AI), AI Agents for structured data output, and Gmail for critical human verification steps.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Project Managers and HR staff who process high volumes of timesheets.

  • Automation engineers looking for advanced examples of integrating human verification loops into an n8n workflow.

  • Users needing robust, resilient OCR and AI data cleaning using n8n and Mistral.

  • Developers searching for specialized n8n templates for document processing.

Overview

This comprehensive n8n workflow solves the complex challenge of automatically processing timesheets received in diverse formats (Excel, PDF, image files). It eliminates manual data entry errors and speeds up approval times by integrating best-in-class extraction methods with critical human oversight. The automation starts by identifying timesheet files in Google Drive. It uses conditional logic via an n8n node to route the files to the appropriate extractor (native n8n Spreadsheet node, external OCR for images, or the powerful Mistral OCR for documents).

Once the raw text is extracted, an AI Agent n8n node meticulously converts the unstructured text into a clean, predictable JSON schema. This ensures the data is ready for downstream applications. To maintain high data fidelity, the structured output is formatted into a readable HTML table and sent for human verification using a Gmail n8n node. This approach makes this specific n8n workflow highly reliable, combining the speed of AI with the accuracy of human review, providing an invaluable n8n template for any organization handling sensitive documents.

How it Works

This highly advanced n8n workflow begins when the n8n trigger is manually activated for testing, initiating a search for files in Google Drive. The workflow iterates over each file. The Download File n8n node fetches the content, and a critical Switch n8n node directs the flow based on the file's MIME type:


  1. Excel Sheets: Directed to the Read Spreadsheet File n8n node, which reads the data. A subsequent Code n8n node ensures that complex Excel serial dates are converted into standard YYYY-MM-DD format.

  2. PDF/Documents: These files are sent through a series of HTTP Request n8n nodes to communicate with the Mistral OCR API. This dedicated n8n workflow path uploads the file, retrieves a signed URL, and executes a document OCR process, yielding highly accurate textual output.

  3. Images: Routed to a generic file-to-text HTTP Request n8n node for basic image OCR extraction.

All extracted text paths converge and are normalized before being passed to the AI Agent n8n node. This agent, configured with a Mistral LLM and strict parsing instructions, standardizes all inputs into a consistent timesheet JSON structure. A Code n8n node then parses the AI output and another Code n8n node transforms the structured data into a formatted HTML email body. Finally, the Gmail n8n node sends this data for human verification, pausing the n8n workflow until the user approves or rejects the extracted data via a custom form. Upon response, the n8n workflow continues to the Google Drive Upload n8n node.

Installation Guide


  1. Import: Copy the provided n8n workflow JSON and import it into your n8n instance using the 'New' > 'Import from JSON' option.

  2. Credentials Setup:

Google Drive: You must set up Google Drive credentials (OAuth2) for file searching, downloading, and final file uploading/archiving. Ensure the credentials have the necessary permissions.
Gmail: Set up Gmail OAuth2 credentials for the human verification step. This n8n node requires permissions to send emails and handle custom form responses.
* Mistral Cloud API: Configure the Mistral Cloud API Key credentials. This is essential for the AI Agent n8n node and the Mistral OCR HTTP calls.

  1. Configuration: Review the Google Drive 'Search files and folders' n8n node configuration to point to the correct folder containing your timesheet documents. Review the Gmail n8n node to set the correct recipient email address for verification.

  2. Test: Use the 'When clicking ‘Test workflow’' n8n trigger to run a test instance and ensure all connections are functioning correctly.

Node Details

This n8n workflow utilizes many crucial n8n node types:

Google Drive (Search files and folders / Download File / Upload file): These core n8n nodes handle all I/O operations with the cloud storage. The Search node acts as the primary data source, locating timesheets.
Switch: A flow control n8n node used to dynamically route the data item based on the file_type (mime type: PDF/Doc, Excel, or Image), ensuring the correct extraction method is applied.
Read Spreadsheet File: A specialized n8n node for Excel files, converting spreadsheet binaries into consumable JSON data.
Code (Clean excel data format / json to html / clean ai output): Custom Code n8n nodes are essential for data transformation. One cleans date formats from Excel data, another parses the raw JSON string output from the AI into usable n8n items, and the third formats the final structured data into an HTML table for Gmail verification.
HTTP Request (Mistral Upload / Mistral DOC OCR / HTTP Request1): Used extensively for proprietary API interactions. The Mistral nodes handle secure document upload and execution of the OCR model. HTTP Request1 calls an external OCR service for image files.
AI Agent (AI Agent to clean and format exctracred data): The central processing n8n node. It leverages a Mistral LLM to transform raw, noisy textual output from the OCR steps into a strictly structured JSON timesheet format, following highly detailed system instructions. This demonstrates advanced use of an n8n node for data cleansing.


  • Gmail (Send a message): This key n8n node creates the human-in-the-loop function. It sends a rich email with a custom verification form, effectively serving as a mandatory approval stage before the n8n workflow proceeds.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by
Rajeet Nair
Rajeet Nair

Featured*