Stop dragging email PDFs into folders by hand. This setup watches a Gmail inbox, reads each PDF, and files only the documents you care about into a Google Drive folder. It is great for invoices, receipts, payslips, and contracts.
Here is how it works. A Gmail trigger grabs new emails and downloads attachments. A code step splits multiple attachments so each file is checked on its own. Non PDF files are skipped. The PDF text is extracted and checked against a safe token limit. OpenAI then looks at the text and answers true or false based on a match term you set, like invoice or payslip. A merge and filter step pairs the AI answer with the file and sends matching PDFs to your chosen Google Drive folder. Large files and non matches are ignored.
You only need Gmail, Google Drive, and an OpenAI API key. In one place, set your match word, paste your Drive folder link, and choose token limits. Send a test email to confirm one file is filed and one is skipped. Teams can cut document triage by up to 90 percent and keep files organized without manual sorting. Finance, HR, and operations can all benefit.