n8n

How to Automate Gmail Invoice Filing to Google Drive?

Turn invoice emails into dated PDFs and file them in the right Google Drive folder without touching a mouse. Built for teams that get billing emails with a link to view the invoice online, this setup keeps finance records tidy and easy to find.

A Gmail trigger checks your inbox every minute. A rule keeps only messages that match your sender or subject. The HTML step pulls all links in the email and a split step looks at each link. A filter keeps the invoice link only. A web call sends that link to a PDF service to create a clean PDF. The file is then uploaded to Google Drive, renamed with today’s date, and moved into your chosen folder. Messages that do not match are ignored.

You will need Gmail and Google Drive connected in n8n Cloud and an API key for a PDF conversion service. Paste your API key and your Drive folder URL in the setup node. Adjust the match rules to your vendor’s sender or subject. Expect to cut monthly filing from an hour to a few minutes and reduce naming mistakes. This is great for subscription receipts, SaaS invoices, and vendor bills sent as links.

What are the key features?

  • Gmail trigger watches for new messages every minute
  • Conditional check keeps only invoice emails based on sender or subject
  • HTML parser extracts all links from the email body
  • Split step processes each link on its own to find the correct target
  • Filter keeps only the link that matches your invoice pattern
  • HTTP request converts the invoice web page to PDF using your API key
  • Google Drive upload stores the PDF as a new file
  • Rename gives the file a clear date based name and Move places it in the right folder
  • Non matching emails go to a no action path to avoid noise

What are the benefits?

  • Reduce manual filing time from 60 minutes to 5 minutes each month
  • Automate 90 percent of steps from email link to Drive storage
  • Cut file naming errors by 95 percent with date based names
  • Connect Gmail, pdflayer and Google Drive in one flow
  • Handle dozens of invoices per day without extra effort
  • Keep invoices in one folder for fast audit checks

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Gmail, Google Drive and pdflayer. See the Tools Required section above for links to create accounts with these services.
  3. Create a pdflayer account and generate an API key on the API page. Keep this key ready.
  4. In n8n Cloud, open the Gmail Trigger node. In the Credential to connect with menu, click Create new credential and follow the on screen steps to connect Gmail.
  5. Open any Google Drive node. In the Credential to connect with menu, click Create new credential and follow the on screen steps to connect Google Drive.
  6. Open the Setup node and paste your pdflayer API key in the api_key field. In url_to_drive_folder, paste your Google Drive folder URL and remove everything after the question mark.
  7. Open the If node that filters invoice emails. Adjust the sender or subject rules to match your vendor. Use clear text that uniquely identifies these invoices.
  8. Check the HTML extract node. Confirm it collects a tags and outputs a field named link. The next Split Out node should point to this link field.
  9. Run a test by sending yourself a sample invoice email that contains a web link to the invoice page. Wait up to one minute for the trigger to poll.
  10. Open Executions in n8n and review the run. Confirm the PDF conversion step returns binary data and the Google Drive upload creates a file.
  11. Verify the Rename step applied the date based name and the Move step placed the file in your chosen folder.
  12. If no file appears, relax the email filter rules or confirm the sender address. If the PDF step fails, check your pdflayer key and that the invoice link is publicly reachable. If upload fails, reauth Google Drive.
  13. Activate the workflow in n8n. Monitor the first week and fine tune the filter so only real invoice emails are processed.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

Google Drive

Sign up

Drive API: $0 (no additional cost; quota-limited)

pdflayer

Sign up

Free: $0 / mo, 100 API requests / mo (rate limit 2 requests/minute)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.