Overview

The process of n8n workflow for documentation sorting automation typically involves a series of connected nodes designed to automatically categorize, organize, and process documents based on predefined criteria. This automation aims to reduce manual effort, improve efficiency, and ensure consistent handling of various document types.

Objective

The objective is to employ a combination of n8n workflow automation, Google Drive, Google Sheets, and a categorization system we built using AI, a means of truly simplifying the process of identifying, categorizing, organizing, and tracking down files on the network. I’m going to drill into each of these steps in this process.

How does it work?

Step 1: Google Drive Trigger (file created)

  • Trigger Event: The event will be “fileCreated”. Meaning that whenever a new file is uploaded in the specified folder, the schedule is immediately triggered.
  • Folder: You can select a folder directly. for instance, “Incoming Files”only the files in that folder.
  • Output: Node returns the metadata for the file uploaded, including its name, id. This information will be subsequently used for categorization and displacement.

Step 2: Split in Batches

  • Batch Size: Set to “1”. This also makes sure it can only process one file at a time, so AI categorization wouldn’t get mixed up having multiple inputs.
  • It’s better: It may not have the same capacity to work on multiple files at once like many other tasks can, but this keeps us on target and ensures each file gets the attention it deserves.

Step 3: AI-Agent: Categorizing and classifying Files

The AI is trained to determine if the file belongs to one of six categories:

  • Invoice
  • Resume/CV
  • Visiting Card
  • Google Docs/HR
  • ID Card
  • Miscellaneous

How It Works

Typo Tolerance: Even if the filename has a typo for example “buisness_card.pdf”, it understands it properly.

Case Insensitive: Lower and upper-case distinctions should not affect search results.

Fuzzy Matching: It doesn’t depend solely on exact keywords, it considers context and related terms.

Fallback to MIME Type: If the filename doesn’t provide a clear indication, the A.I. will make decisions citing the file type (PDF, DOCX, PNG, etc.) as a clue.

Step 4: Categorize File (Code Node)

In the next step, a Code Node that parses the AI output. Its work is to scrape the necessary details which are needed for the subsequent steps.

Example Output Fields

  • File Name: The name part of the uploaded file.
  • Mime Type: The kind of format (PDF, DOCX, PNG, and so on).
  • Category: AI’s classification result.
  • Folder Id: The id of the folder of the file

Step 5: Move File (Google Drive)

File ID: Copied from the trigger output, so only that file will be moved.

Destination Folder ID: This is the categorization output from AI that we supplied.

Step 6: Formulate Log Entry (Code Node)

Example Data Fields:

  • File Name
  • Destination Folder ID
  • Mime Type
  • Timestamp
  • Category

Step 7: Append Row in Google Sheets

And lastly, the log entry in the desired format is being posted to Google Sheets using an Append Row node.

  • Sheet ID: The Google Sheet’s where logs are logged.
  • Range: Tells us which sheet or tab (for instance, “File Records”).
  • Input: Previous code node[Structured data].

End to End Data Flow

Google Drive Triggered When A File Is Uploaded To Google Drive

01
Batch processing : Split in Batches
02
Type: Done by the AI Agent
03
Data Parsing : Handled by Categorize File
04
Move File : Google Drive node places file to right category folder
05
Prepare log entry : Code node makes the data look like this
06
Log Entry : Google Sheets: adds the details up to a Google Sheets node

Technology Stack Included

Key Benefits

Completely Automated File Categorisation

This feature automatically classifies files as soon as they are uploaded, saving manual labour.

Addresses Misspellings And Typos

AI-driven fuzzy matching makes sure that files are arranged accurately even when there are naming mistakes.

Consistent File Organisation

Keeps Google Drive’s folder structure neat and orderly.

Automatic Record-Keeping

Google Sheets keeps track of all file transfers, generating an open audit trail.

Suitable for a Variety of File

It is adaptable for business use because it supports both PDFs and image files.

Closure

This automated process is a prime example of how smart file management can revolutionise day-to-day tasks.  By leveraging Google Drive, n8n, Mistral AI, and Google Sheets, businesses eliminate the headaches of manual categorization and logging.