{"product_id":"gmail-invoice-pdf-to-google-sheets-openai-n8n-workflow","title":"Gmail Invoice PDF to Google Sheets (OpenAI) n8n Workflow","description":"\u003ch3\u003eTurn Gmail invoice PDFs into validated Google Sheets entries—automatically (with OpenAI)\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow monitors your Gmail for supplier invoice emails with PDF attachments, extracts invoice data using OpenAI, validates totals \u0026amp; VAT logic, and then appends clean records to an \u003cstrong\u003eInvoices\u003c\/strong\u003e tab in Google Sheets—routing any issues to an \u003cstrong\u003eExceptions\u003c\/strong\u003e tab for review.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGmail trigger (every minute):\u003c\/strong\u003e Watches a specified Gmail label for new messages that include attachments, then downloads attachments for processing.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePDF filtering:\u003c\/strong\u003e Keeps only \u003cem\u003ePDF\u003c\/em\u003e attachments from incoming emails.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePDF → text conversion:\u003c\/strong\u003e Converts the PDF content into plain text for reliable extraction.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI structured extraction:\u003c\/strong\u003e Sends the extracted text to OpenAI to pull structured invoice fields using a strict schema (supplier, invoice number, dates, currency, totals, VAT, and line items).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidation \u0026amp; reconciliation:\u003c\/strong\u003e Checks required fields, verifies \u003cstrong\u003enet + VAT ≈ gross\u003c\/strong\u003e, sums line items, ensures VAT rates are allowed, and flags \u003cstrong\u003enegative totals\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Sheets output:\u003c\/strong\u003e Appends validated invoices to the \u003cstrong\u003eInvoices\u003c\/strong\u003e tab; non-reconciling results (including problem details) go to the \u003cstrong\u003eExceptions\u003c\/strong\u003e tab.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSaaS finance ops:\u003c\/strong\u003e Automatically populate an “Invoices” sheet from email PDFs to reduce manual data entry.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAP teams \u0026amp; bookkeeping:\u003c\/strong\u003e Catch OCR\/extraction errors early by routing mismatches to “Exceptions”.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAutomation engineers:\u003c\/strong\u003e Use as a template for Gmail + PDF parsing + OpenAI extraction + Google Sheets reconciliation.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTriggers\/Nodes:\u003c\/strong\u003e gmail trigger, filter, code, if, sticky note\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAI extraction:\u003c\/strong\u003e OpenAI API using an extraction model with a strict schema\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSpreadsheet storage:\u003c\/strong\u003e Google Sheets (requires an \u003cstrong\u003eInvoices\u003c\/strong\u003e tab and an \u003cstrong\u003eExceptions\u003c\/strong\u003e tab with columns matching extracted fields)\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eSetup requirements\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eAdd \u003cstrong\u003eGmail credentials\u003c\/strong\u003e and configure the \u003cstrong\u003eGmail label ID\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eAdd \u003cstrong\u003eOpenAI API credentials\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eAdd \u003cstrong\u003eGoogle Sheets credentials\u003c\/strong\u003e and update the spreadsheet URL.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45889858502835,"sku":"N8N-18603","price":12.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/YHRC62yoOmMk1AGM76nWm_GMcSok2g.png?v=1787498738","url":"https:\/\/buyflowscripts.com\/products\/gmail-invoice-pdf-to-google-sheets-openai-n8n-workflow","provider":"N8N Commerce","version":"1.0","type":"link"}