Connect Google Drive
• In n8n, connect your Google Drive account.
• Create or select a folder where you will upload scanned invoices.
Connect Gmail (or another email service)
• Add your Gmail account as a credential in n8n.
• This will be used to send the processed invoice to the correct recipient.
Set up OCR.Space
• Create a free OCR.Space account: https://ocr.space
• In n8n, create a Generic Credential (Header Auth).
• Use apikey as the name and your OCR API key as the value.
Connect the AI Agent
• Add your OpenAI API key as a credential in n8n.
• The AI Agent will extract the company name from the invoice text and match it against your database.
• If a match is found, it retrieves the correct email.
Prepare the Google Sheet database
• Make a copy of the database sheet: Google Sheet Template
• Fill it with company names and recipient emails.
• Connect your Google account to n8n and link this sheet to the workflow.
Run the workflow
• When a new invoice is uploaded to your Google Drive folder, the workflow will:
• Extract the text with OCR.Space
• Use the AI Agent to identify the company name
• Cross-reference it with your Google Sheet database
• Send the invoice automatically to the correct recipient via Gmail
• If no match is found, an error email is sent to you for manual review