{"product_id":"gmail-invoice-automation-with-n8n-gpt-4-1-mini-sheets-drive","title":"Gmail Invoice Automation with n8n, GPT-4.1-mini, Sheets \u0026 Drive","description":"\u003ch3\u003eAutomatically capture invoices from Gmail, extract data with GPT-4.1-mini, and log everything to Google Sheets + Drive\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow scans your \u003cstrong\u003eGmail\u003c\/strong\u003e daily for unread invoice\/receipt emails, uses \u003cstrong\u003eGPT-4.1-mini\u003c\/strong\u003e to classify the message and extract structured fields (including text from the first attached PDF), then saves PDFs to \u003cstrong\u003eGoogle Drive\u003c\/strong\u003e and records invoice activity in \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e. You also get a \u003cstrong\u003edaily digest\u003c\/strong\u003e email summary.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns every day at 7 AM\u003c\/strong\u003e on a schedule.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReads existing rows from Google Sheets\u003c\/strong\u003e to track previously processed invoices.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFetches unread Gmail messages\u003c\/strong\u003e and converts each email body to plain text.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eExtracts PDF text\u003c\/strong\u003e from the \u003cem\u003efirst attached PDF\u003c\/em\u003e (when present) and merges email + PDF text into a single analysis payload.\u003c\/li\u003e\n  \u003cli\u003eCalls \u003cstrong\u003eOpenAI (GPT-4.1-mini)\u003c\/strong\u003e to classify the message as invoice\/receipt\/other and extract structured invoice\/receipt fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDeduplicates and updates records\u003c\/strong\u003e: compares extracted invoices against existing Google Sheets entries, matches receipt emails to unpaid invoices, and decides whether to append new rows or mark invoices paid.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUploads attachments to Google Drive\u003c\/strong\u003e (when required) and records resulting file links.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eMarks Gmail messages as read\u003c\/strong\u003e, applies a processed label, updates Google Sheets, and sends a \u003cstrong\u003eformatted daily digest\u003c\/strong\u003e via Gmail.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eAP\/finance teams who receive \u003cstrong\u003einvoices and receipts by email\u003c\/strong\u003e and need a reliable system of record.\u003c\/li\u003e\n  \u003cli\u003eSaaS operators tracking billing with \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e as a lightweight ledger.\u003c\/li\u003e\n  \u003cli\u003eAutomation engineers building an \u003cstrong\u003einvoice data extraction\u003c\/strong\u003e pipeline that combines email parsing + PDF handling + spreadsheet logging.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eScheduled trigger\u003c\/strong\u003e (daily at 7 AM).\u003c\/li\u003e\n  \u003cli\u003eNodes\/logic includes: \u003cstrong\u003eif\u003c\/strong\u003e, \u003cstrong\u003eset\u003c\/strong\u003e, \u003cstrong\u003ecode\u003c\/strong\u003e, \u003cstrong\u003egmail\u003c\/strong\u003e, \u003cstrong\u003emerge\u003c\/strong\u003e, \u003cstrong\u003efilter\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eIntegrations: \u003cstrong\u003eGmail\u003c\/strong\u003e, \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e, \u003cstrong\u003eGoogle Drive\u003c\/strong\u003e, and \u003cstrong\u003eOpenAI\u003c\/strong\u003e with \u003cstrong\u003eGPT-4.1-mini\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eRequires: Gmail\/Google credentials + an OpenAI credential connected to the extraction chain after importing.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45869896237235,"sku":"N8N-18430","price":4.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/5aboQPnZ8Z2geEkMk27jF_LLYMRZyh.png?v=1787130698","url":"https:\/\/buyflowscripts.com\/products\/gmail-invoice-automation-with-n8n-gpt-4-1-mini-sheets-drive","provider":"N8N Commerce","version":"1.0","type":"link"}