{"product_id":"gmail-pdf-invoice-extraction-to-google-sheets-with-openai-n8n","title":"Gmail PDF Invoice Extraction to Google Sheets with OpenAI (n8n)","description":"\u003ch3\u003eTurn PDF invoices in Gmail into structured rows in Google Sheets—automatically (with OpenAI) \u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow polls \u003cstrong\u003eGmail\u003c\/strong\u003e for unread emails with \u003cstrong\u003ePDF attachments\u003c\/strong\u003e, extracts invoice data with \u003cstrong\u003eOpenAI (gpt-4o-mini)\u003c\/strong\u003e, and appends a clean, structured record to your Google Sheets \u003cstrong\u003eInvoices\u003c\/strong\u003e ledger—no manual copy\/paste required.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eChecks Gmail every 5 minutes\u003c\/strong\u003e for unread emails that include a `PDF` attachment.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDownloads the PDF attachment\u003c\/strong\u003e and extracts its text (works with \u003cem\u003eborn-digital PDFs\u003c\/em\u003e that contain a text layer).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSends extracted text to OpenAI\u003c\/strong\u003e using \u003cstrong\u003egpt-4o-mini\u003c\/strong\u003e to extract key invoice fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOutputs results to a strict schema\u003c\/strong\u003e (designed so the model doesn’t invent values).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAppends a new row\u003c\/strong\u003e to the Google Sheets document, including invoice fields plus email metadata such as:\n    \u003cul\u003e\n      \u003cli\u003eReceived date\u003c\/li\u003e\n      \u003cli\u003eSender\u003c\/li\u003e\n      \u003cli\u003eFilename\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \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 \u003cstrong\u003einvoice ledger\u003c\/strong\u003e from vendor emails landing in Gmail.\u003c\/li\u003e\n  \u003cli\u003eReduce accounts payable processing time by converting invoice PDFs into a \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e dataset.\u003c\/li\u003e\n  \u003cli\u003eSupport SaaS operations teams who need consistent invoice fields for reporting and reconciliation.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGmail polling + download\u003c\/strong\u003e: polls for unread emails with PDF attachments, then downloads them.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePDF text extraction\u003c\/strong\u003e: extracts text from the attached PDF.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI extraction\u003c\/strong\u003e: uses \u003cstrong\u003en8nn8n-nodes-langchainlm chat open ai\u003c\/strong\u003e with \u003cstrong\u003egpt-4o-mini\u003c\/strong\u003e and an information extractor node (\u003cstrong\u003en8nn8n-nodes-langchaininformation extractor\u003c\/strong\u003e) to produce structured invoice fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Sheets append\u003c\/strong\u003e: appends to the \u003cstrong\u003eInvoices\u003c\/strong\u003e tab (e.g., columns like \u003cem\u003eReceivedDate, FromEmail, Vendor, InvoiceNumber, InvoiceDate, DueDate, Net, Tax, Total, Currency, FileName\u003c\/em\u003e).\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eSetup \u0026amp; customization\u003c\/h3\u003e\n\u003cp\u003eConnect \u003cstrong\u003eGmail\u003c\/strong\u003e, \u003cstrong\u003eOpenAI\u003c\/strong\u003e, and \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e credentials in n8n. Replace \u003cstrong\u003eYOUR_GOOGLE_SHEET_ID\u003c\/strong\u003e, confirm the sheet name is \u003cstrong\u003eInvoices\u003c\/strong\u003e, and (optionally) narrow the Gmail search query or extend the extraction schema (e.g., PO number or line items).\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45785626149043,"sku":"N8N-17920","price":22.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/9OrhQStFCloZ-B3oaINNn_Nk7rB2pO.png?v=1786179973","url":"https:\/\/buyflowscripts.com\/products\/gmail-pdf-invoice-extraction-to-google-sheets-with-openai-n8n","provider":"N8N Commerce","version":"1.0","type":"link"}