Skip to main content

Validate shipments & generate freight documents with GPT-4o, Google Sheets & Drive

Workflow preview

Workflow preview
100%
Validate shipments & generate freight documents with GPT-4o, Google Sheets & Drive preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

What problem does this workflow solve? Logistics teams spend hours manually validating shipment data, checking compliance, generating freight documents, and emailing stakeholders. Errors in HSN c...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googlesheetstrigger, n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.gmail, n8n-nodes-base.extractfromfile, n8n-nodes-base.httprequest, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by InfyOm Technologies.

Original n8n.io source

1.1 Workflow description

Title
Validate shipments & generate freight documents with GPT-4o, Google Sheets & Drive
Workflow name
Validate shipments & generate freight documents with GPT-4o, Google Sheets & Drive

βœ… What problem does this workflow solve?

Logistics teams spend hours manually validating shipment data, checking compliance, generating freight documents, and emailing stakeholders. Errors in HSN codes, weights, or carrier details can lead to shipment delays, penalties, and rework.

This workflow automates the entire shipment validation and documentation process using AI, ensuring compliance, reducing errors, and generating professional freight documents automatically.


βš™οΈ What does this workflow do?

  • Validates shipment details using AI before documentation.
  • Detects mismatches in HSN codes, weights, ports, and carrier data.
  • Automatically notifies shippers when issues are found.
  • Generates compliant freight documents in PDF format.
  • Emails shipment PDFs to both sender and receiver.
  • Stores documents securely in Google Drive.
  • Tracks shipment status and document links in Google Sheets.

πŸ’‘ Main Use Cases

  • Automate freight document generation for export/import shipments.
  • Perform AI-based compliance checks on shipment data.
  • Instantly flag and notify incorrect or missing shipment details.
  • Maintain a centralized audit trail of shipment documents.
  • Reduce manual validation effort and paperwork.

🧠 How It Works – Step-by-Step

1. Google Sheets Trigger

The workflow starts when new shipment data is added to a shared Google Sheet. Each row represents a shipment with details like:

  • Shipment ID
  • Shipper & Receiver information
  • Carrier details
  • Ports
  • Goods description
  • Quantity, weight, and HSN codes

2. AI-Powered Shipment Validation

An AI agent (OpenAI) validates each shipment against defined rules:

  • Valid HSN codes for goods
  • Export/import compliance
  • Quantity vs. weight consistency
  • Carrier name matched against an active carrier reference list
  • Proper formatting of ports and addresses

The AI returns a structured result:

  • valid: true/false
  • reason: Explanation of the first detected issue

3. Mismatch Handling (If Validation Fails)

If the shipment is invalid:

  • An email is sent to the shipper with detailed mismatch information.
  • The shipment status is updated in Google Sheets as Mismatch_Details.
  • No documents are generated until corrections are made.

4. Freight Document Generation (If Validation Passes)

If the shipment is valid:

  • A dynamic HTML shipment report is created.

  • The HTML is converted into a professional PDF using ConvertAPI.

  • The PDF includes:

    • Shipment summary
    • Goods information
    • Quantity, weight, and HSN details

5. Email Distribution

The generated shipment PDF is automatically emailed to:

  • πŸ“€ The Shipper
  • πŸ“₯ The Receiver

Each email includes shipment reference details and a download link.


6. Storage & Tracking

  • The shipment PDF is uploaded to a dedicated Google Drive folder.

  • Google Sheets is updated with:

    • Shipment status (shipment_pdf_dispatch)
    • Google Drive document link
  • This creates a complete audit trail for compliance and tracking.


πŸ—‚ Integrations Used

  • Google Sheets – Shipment input, status tracking, carrier reference data
  • OpenAI – AI-based shipment validation and compliance checks
  • ConvertAPI – HTML-to-PDF freight document generation
  • Gmail – Automated email notifications
  • Google Drive – Secure document storage

πŸ‘€ Who can use this?

This workflow is ideal for:

  • 🚒 Freight forwarders
  • πŸ“¦ Logistics & supply chain teams
  • 🏒 Export-import companies
  • πŸ“‘ Compliance and documentation teams

If your shipping process involves repetitive checks, document creation, and manual emailsβ€”this automation can save hours per shipment.


πŸš€ Benefits

  • βœ… Automated compliance validation
  • βœ… Reduced shipment errors and delays
  • βœ… Faster document turnaround
  • βœ… Centralized storage and tracking
  • βœ… Audit-ready logistics process

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Google Sheets Trigger

Type / Role
n8n-nodes-base.googleSheetsTrigger - googleSheetsTrigger
Config choices
Version 1

Block 2 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 4 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 5 - Send Shipment PDF To Sender

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 6 - Send Shipment PDF To Receiver

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 7 - Get PDF

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 8 - PDF Generate

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 9 - Set Shipment Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - If Validate

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 11 - Send Mismatch Items Details

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 12 - Update State

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 13 - Append or update row in sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 14 - Validate Shipment details

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 15 - Upload file

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 16 - Download File

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 17 - Carrier Details

Type / Role
n8n-nodes-base.googleSheetsTool - googleSheetsTool
Config choices
Version 4.7

Block 18 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Workflow Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Data Ingestion

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - PDF Generation

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Storage & Tracking

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Error Handling

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Validate shipments & generate freight documents with GPT-4o, Google Sheets & Drive
Complexity advanced
Nodes 23
Categories Document Extraction, AI Summarization
Author InfyOm Technologies
Published 18 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11913/11913.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Validate shipments & generate freight documents with GPT-4o, Google Sheets & Drive do?

What problem does this workflow solve? Logistics teams spend hours manually validating shipment data, checking compliance, generating freight documents, and emailing stakeholders. Errors in HSN c...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.