{"product_id":"gmail-pdf-invoice-extractor-to-google-sheets-n8n-openai","title":"Gmail PDF Invoice Extractor to Google Sheets (n8n + OpenAI)","description":"\u003ch3\u003eTurn Gmail PDF invoices into structured Google Sheets rows—automatically\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow scans your \u003cstrong\u003eGmail\u003c\/strong\u003e inbox for \u003cstrong\u003ePDF invoice attachments\u003c\/strong\u003e, stores each file in a month-based \u003cstrong\u003eGoogle Drive\u003c\/strong\u003e folder, and uses \u003cstrong\u003eOpenAI\u003c\/strong\u003e to extract invoice fields—then appends qualifying invoices to a \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e tab for the current month.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns hourly\u003c\/strong\u003e from Gmail (and can be run manually for backfilling a date range).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDownloads attachments\u003c\/strong\u003e and \u003cstrong\u003efilters out unwanted senders\u003c\/strong\u003e, keeping only \u003cstrong\u003ePDF\u003c\/strong\u003e attachments.\u003c\/li\u003e\n  \u003cli\u003eLocates (or targets) the \u003cstrong\u003ecurrent month’s Google Drive folder\u003c\/strong\u003e using a \u003cstrong\u003eYYYY-MM\u003c\/strong\u003e naming pattern (e.g., \u003cem\u003e2026-04\u003c\/em\u003e), then uploads each PDF and builds shareable links for both the file and its folder.\u003c\/li\u003e\n  \u003cli\u003eExtracts text from each PDF and sends it to an \u003cstrong\u003eOpenAI-powered agent\u003c\/strong\u003e that returns \u003cstrong\u003estrict JSON\u003c\/strong\u003e with structured invoice fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRetries with an auto-fixing parser\u003c\/strong\u003e when the JSON is not perfectly formatted.\u003c\/li\u003e\n  \u003cli\u003eChecks for \u003cstrong\u003eSales Tax or VAT\u003c\/strong\u003e, and if present, appends invoice details—plus the \u003cstrong\u003ePDF URL\u003c\/strong\u003e and \u003cstrong\u003eDrive folder link\u003c\/strong\u003e—to a \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e tab named for the current month.\u003c\/li\u003e\n  \u003cli\u003eUses a short \u003cstrong\u003ewait\u003c\/strong\u003e between processing PDFs, then continues with the next attachment.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eMaintain an always-up-to-date invoicing ledger in Google Sheets from incoming supplier emails.\u003c\/li\u003e\n  \u003cli\u003eCentralize invoice PDFs in Drive by month while capturing key fields (company, invoice number, totals, taxes).\u003c\/li\u003e\n  \u003cli\u003eFlag invoices that include \u003cstrong\u003eSales Tax\u003c\/strong\u003e or \u003cstrong\u003eVAT\u003c\/strong\u003e for streamlined tax reporting.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eIntegrations: \u003cstrong\u003eGmail\u003c\/strong\u003e, \u003cstrong\u003eGoogle Drive\u003c\/strong\u003e, \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e, and \u003cstrong\u003eOpenAI\u003c\/strong\u003e (with an OpenAI API key for both OpenAI chat model connections).\u003c\/li\u003e\n  \u003cli\u003en8n nodes\/tech stack mentioned: \u003cstrong\u003eif\u003c\/strong\u003e, \u003cstrong\u003ecode\u003c\/strong\u003e, \u003cstrong\u003ewait\u003c\/strong\u003e, \u003cstrong\u003egmail\u003c\/strong\u003e, \u003cstrong\u003emerge\u003c\/strong\u003e, \u003cstrong\u003efilter\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eSetup requires: updating the Sheets document ID and ensuring column names match the mapped fields (e.g., Company Name, Invoice Number, taxes, totals, links, capture date), plus configuring the Drive parent folder ID.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45891842408627,"sku":"N8N-18624","price":75.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/KshoixBNeI3rLxxUayJi-_GgnVENOa.png?v=1787562316","url":"https:\/\/buyflowscripts.com\/products\/gmail-pdf-invoice-extractor-to-google-sheets-n8n-openai","provider":"N8N Commerce","version":"1.0","type":"link"}