Skip to content
FlowHubFluxonLab
C
AI Automationfree

Extract invoice data from Google Drive images with GPT-4o and Postgres

by pawanadapted from n8n official workflow galleryUpdated Aug 2026
RequiresCCodeGoogle DriveGoogle DriveOpenAIPostgresPostgres
Share Post Share
GDGoogle Drive File TriggerGoogle Drive Fi…AI Image AnalyzerAI Image Analyz…CoParse JSON ResponseParse JSON Resp…Check Duplicate EntryCheck Duplicate…Insert Invoice RecordInsert Invoice …Download from Google DriveDownload from G…Move to Failed FolderMove to Failed …Move to Processed FolderMove to Process…IfIf Duplicate FoundIf Duplicate Fo…Move to Duplicate FolderMove to Duplica…1234567891011
1/5
STEPS · 11
Starts on a Google Drive event

Quick overview This workflow watches a Google Drive folder for new invoice images, extracts key invoice fields with OpenAI vision, checks for duplicates in Postgres, and then stores the invoice or moves the file into processed, duplicate, or failed folders. How it works Triggers every hour when a new file is created in a specific Google Drive folder. Downloads the new file from Google Drive and sends the image to OpenAI (GPT-4o) to extract invoice fields as JSON. Cleans and parses the AI response into structured invoice data, routing invalid or unparseable results to a failed path. Checks Postgres to see if an invoice with the same vendor name, invoice number, and total already exists. If the invoice is a duplicate, moves the source file in Google Drive to a duplicate folder. If the invoice is not a duplicate, inserts the invoice into the Postgres invoices table (status set to processed) and moves the source file to a processed folder. Setup Connect Google Drive OAuth2 credentials and set the incoming, processed, duplicate, and failed folder IDs to match your Drive structure. Add an OpenAI API credential and ensure the selected model (gpt-4o) is available for image analysis.

Tags

n8nreference-onlygoogle-driveopen-aipostgres
Connects
CCodegoogledriveGoogle DriveOpenAIpostgresPostgres
CategoryAI Automation
Triggermanual
Complexitycomplex
Nodes10
AddedJul 12, 2026

Related workflows

See all AI Automation
ACW
free

Run a multimodal WhatsApp AI assistant with OpenAI for text, voice and images

Quick overview This workflow turns WhatsApp into a multimodal assistant that answers text, voice notes, images, and PDF documents using OpenAI, and can generate images with DALL·E on demand, replying back in WhatsApp with either text, audio, or an image. How it works Triggers when a new WhatsApp message is received. Detects whether the incoming message is text, a voice note, an image, a PDF document, or an unsupported type. For text messages, generates an image with OpenAI DALL·E when the message starts with the configured /image command, and sends the generated image back to the sender. For voice notes, fetches the WhatsApp media URL, downloads the audio, transcribes it with OpenAI, and forwards the transcript to the assistant. For images, fetches the WhatsApp media URL, downloads the image, describes it with OpenAI vision using the configured analysis prompt, and forwards the description (plus any caption) to the assistant. For PDF documents, downloads the file from WhatsApp, extracts the PDF text, and forwards the extracted content (plus any caption) to the assistant, while non-PDF files receive an error message. Uses an OpenAI chat model with per-contact short-term memory to ge

by Dr. Firas
binaryinputloaderembeddingsopenaigoogledriveopenaichatmodel
free

Ask questions about a PDF using AI

The workflow first populates a Pinecone index with vectors from a Bitcoin whitepaper. Then, it waits for a manual chat message. When received, the chat message is turned into a vector and compared to the vectors in Pinecone. The most similar vectors are retrieved and passed to OpenAI for generating a chat response. Note that to use this template, you need to be on n8n version 1.19.4 or later.

by David Roberts
AWopenaichatmodel
free

Handle WhatsApp support text and voice messages with OpenAI GPT-5 Mini

Quick overview This workflow responds to incoming WhatsApp Business messages, handling both text and voice notes by transcribing audio with OpenAI and replying with an OpenAI chat agent that uses per-contact conversation memory and answers only from the business information you provide. How it works Triggers when a new WhatsApp message is received. Routes the incoming message by type, sending text messages directly to the support flow, audio messages to a voice-transcription flow, and other message types to a fallback reply. For voice notes, retrieves the WhatsApp media URL, downloads the audio file, and transcribes it to text with OpenAI. Sends the customer’s text (original or transcribed) to an OpenAI chat agent configured to answer only using your provided business information. Stores and reuses a per-contact conversation history keyed by the sender’s WhatsApp number to maintain context across messages. Sends the agent’s response back to the customer as a WhatsApp text message. Setup Connect WhatsApp Business Cloud credentials for both receiving messages (trigger) and sending replies, and ensure your WhatsApp webhook is configured to point to the trigger URL. Add OpenAI credenti

by Manik Chandra Dhor