n8n

How to Automate Gmail Invoice Capture to Drive and Sheets?

Collect invoices from Gmail, save the PDFs to Google Drive, and record clean invoice data in Google Sheets. Finance teams get fast, accurate invoice capture without manual data entry. Ideal for accounts payable and monthly close.

New unread emails are checked every minute. Only messages with invoice attachments continue. The file uploads to Google Drive, gets a clear name using the email subject and today’s date, and moves into your chosen folder. The system then downloads the stored PDF, converts it to text, and uses an AI model with a structured parser to pull fields like invoice number, date, vendor, and total. A mapped set of fields is appended as a new row to your reconciliation sheet. The source email is marked as read to avoid duplicates.

Connect Gmail, Google Drive, Google Sheets, and OpenAI. Set your Drive folder ID in the setup node and choose the correct spreadsheet and tab. Expect faster close, fewer errors, and better audit trails. Great for bookkeeping firms, startups, and in house finance teams that receive many invoices by email.

What are the key features?

  • Gmail polling checks unread messages every minute and downloads attachments
  • Filter passes only emails that look like invoices and include attachments
  • PDFs upload to Google Drive, get renamed with subject and date, and are moved into a target folder
  • Downloads the stored PDF from Drive and converts it to text for analysis
  • AI model with a structured parser extracts invoice number, date, vendor, and total
  • Mapped fields align with your Google Sheets columns for clean appends
  • Marks the original email as read to prevent duplicate processing

What are the benefits?

  • Reduce manual invoice entry from 2 hours to 10 minutes per day
  • Automate up to 90% of invoice capture steps
  • Improve data accuracy by 90% by removing copy and paste errors
  • Handle 10 times more invoices without extra headcount
  • Connect Gmail, Google Drive, Google Sheets, and OpenAI in one flow

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, Google Sheets and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. Open the Gmail Trigger node and create a new Gmail OAuth2 credential. Follow the on screen steps to grant read access. Set the filter to Unread and enable attachment download.
  4. Open the Google Drive nodes (Rename file, Move to the correct folder, and Google Drive download). In each node, create or select a Google Drive OAuth2 credential and allow file read and write permissions.
  5. In the HTTP Request node used to upload files to Drive, select the same Google Drive credential. Keep method POST and uploadType set to media. Confirm the binary field points to the correct attachment.
  6. Open the Google Sheets Append node and create a Google Sheets OAuth2 credential. Choose your spreadsheet and sheet. Map the columns to the fields provided by the Map Output node.
  7. Open the OpenAI Model node. Click Create new credential, paste your OpenAI API key from the OpenAI account page, and select the gpt 4o model with temperature 0.
  8. In the Structured Output Parser and Apply Data Extraction Rules nodes, review the schema and rules for fields like invoice number, date, vendor, and total. Adjust names to match your sheet columns if needed.
  9. Open the Setup node and replace the folder ID with the ID of your target Drive folder. You can copy the ID from the folder URL in Google Drive.
  10. In the Rename file node, confirm the file name pattern fits your needs. You can keep the subject and date format or add other labels.
  11. Run a live test by emailing a PDF invoice to the connected Gmail inbox. Check that the file lands in the correct Drive folder, the email is marked as read, and a new row appears in your Google Sheet.
  12. Troubleshoot common issues: if no PDF is found, confirm the email has a true attachment and the Gmail scope is correct. If the upload fails, verify Drive permissions. If the sheet row is empty, review the parser schema and field mappings. Share the spreadsheet with the Google account tied to your credential.

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)

Google Sheets

Sign up

Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

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.