Back to Templates

Extract Purchase Orders from Gmail using Gemini AI and Save to Google Sheets

Last update

Last update 2 days ago

Share


📧 AI-Powered Email to Purchase Order Workflow

Automatically scan your inbox for new purchase order requests, extract order details using Gemini AI, and log them into Google Sheets — all without manual effort.

✨ Features

  • ⏱ Runs every minute to check unread emails
  • 🎯 Filters emails by subject (e.g., Marketing, Buchungsanfrage)
  • 🤖 Uses Gemini AI to summarize email content & extract structured order details
  • 📊 Normalizes dates into ISO calendar weeks (e.g., KW36)
  • 🔗 Enriches order info with product data from Google Sheets
  • 📝 Appends final purchase order records into a Google Sheet

🛠 Requirements

  • Gmail account for fetching unread emails
  • Google Gemini (PaLM) API credentials
  • Google Sheet with predefined purchase order headers

⚙️ Setup

  1. Configure Gmail & Google Sheets credentials in n8n
  2. Adjust the subject filter to match your email rules
  3. Connect Gemini AI with your API credentials
  4. Create a Google Sheet with the required headers
  5. Activate the workflow and let it run in the background 🚀

🔧 How to Customize This Workflow

  • Email Filters → Change the keywords in the filter node to match your own purchase order email subjects.
  • Order Fields → Modify the Set and Append to Google Sheet nodes if your purchase order schema differs.
  • AI Instructions → Adjust the AI Agent’s prompt to better fit your company’s email style or product details.
  • Frequency → Update the Cron node if you want to scan emails less often (e.g., every 10 minutes or hourly).
  • Target Google Sheet → Point to a different Google Sheet or tab depending on your department or customer.