In this guide · 8 sections
- 01Which method fits your email system
- 02Outlook to OneDrive or SharePoint with Power Automate
- 03Gmail to Google Drive with Apps Script
- 04Naming rules, folders and duplicates
- 05Security: malicious attachments and access
- 06When a receipt-capture tool is the better choice
- 07Do it yourself or get help?
- 08Frequently asked questions
Short answer
In Microsoft 365, build a Power Automate flow: when a new email with attachments arrives in a folder, create each attachment as a file in OneDrive or SharePoint. In Google Workspace, an Apps Script on a timer saves attachments from labelled Gmail threads to a Drive folder. Filter by sender and file type.
Which method fits your email system
Use the tool that already comes with your email. Both are included in business plans and need no extra subscription for this job.
| Microsoft 365 (Outlook) | Google Workspace (Gmail) | |
|---|---|---|
| Tool | Power Automate cloud flow | Google Apps Script |
| Saves to | OneDrive or a SharePoint document library | A Google Drive or shared drive folder |
| How it starts | Instantly, when a new email arrives | On a timer, for example every 15 minutes |
| Skill needed | Point-and-click designer | A short script, copied and adjusted |
| Licence | Standard connectors are included with Microsoft 365 business plans | Included with Google Workspace and Gmail |
Microsoft's licensing documentation says Microsoft 365 licences include a limited set of Power Automate capabilities, and standard connectors such as Outlook and OneDrive are among them. Google's Apps Script is available to every Gmail and Workspace account.
Gmail to Google Drive with Apps Script
Gmail has no built-in save-to-Drive rule, but a short Apps Script does the job. The usual pattern uses Gmail labels to track what has been processed.
Create two labels and a filter
Make labels such as Invoices/To file and Invoices/Filed. Add a Gmail filter that applies To file to emails from your suppliers or with invoice in the subject and an attachment.
Create the script
At script.google.com, create a project. The script searches for threads labelled To file, saves each PDF attachment to a Drive folder with DriveApp, then swaps the label to Filed.
Add a time-driven trigger
In Triggers, run the function every 15 or 30 minutes. Apps Script cannot start instantly on a new email, so a short delay is normal.
Authorise and test
Run it once by hand, approve the Gmail and Drive permissions, then send a test invoice and wait for the next run.
Google's quota page sets limits that matter here: each run can last up to 6 minutes, and time-driven triggers can run for 90 minutes a day in total on consumer Gmail accounts or 6 hours a day on Google Workspace. Process a limited batch of threads per run so a busy morning does not hit the limit. Our Apps Script automation guide covers the basics of scripts and triggers.
Naming rules, folders and duplicates
Automatic saving is only useful if people can find files later. Decide the rules before you build.
- Folder by month or financial year: /Accounts/Invoices/2026/10 keeps folders small and matches how your accountant works.
- File name pattern: date received, supplier, then the original file name, for example 2026-10-19_SupplierName_INV-1042.pdf.
- Supplier name from the sender: map known sender addresses to short supplier names; put unknown senders in an Unsorted folder.
- Duplicates: suppliers resend invoices. Check whether a file with the same name exists and skip it or add a suffix, rather than overwriting.
- Keep the email: add a link or the email subject in the file description, or keep the email in a Filed label or folder, for audit.
Security: malicious attachments and access
Attackers send fake invoices with harmful attachments precisely because finance staff open them. An automation that saves every attachment can spread a malicious file into a shared folder where more people open it.
Before you switch the automation on
Fake invoices are also a common route for payment fraud. An automation should file documents, never approve or pay them.
When a receipt-capture tool is the better choice
If the goal is getting bills into Xero or QuickBooks, a receipt-capture service may beat a home-made flow. Tools like Dext and Hubdoc give you a dedicated email address, read the supplier, date, amount and GST from each document and publish it to your accounting software.
A Drive or SharePoint flow suits you if
- You mainly need documents filed and findable
- You want no extra subscription
- Attachments include contracts, DOs and statements, not just bills
A receipt-capture tool suits you if
- Bills must end up in Xero or QuickBooks
- You want amounts and GST extracted automatically
- Your accountant already uses one
Our Dext vs Hubdoc comparison covers prices and differences for Singapore businesses.
Do it yourself or get help?
A simple version, one folder and one supplier filter, is a good first DIY project in either Power Automate or Apps Script. Handling double triggers, duplicates, naming maps and safe file types takes longer to get right.
Our Workflow Automation (S$390 per workflow) builds one workflow of up to 5 steps on Make, Zapier or Google Apps Script in your own account, with error alerts to your email and documentation of how it works. Make and Zapier also connect to Outlook, OneDrive and SharePoint.
Frequently asked questions
Not with a basic Outlook rule, but Power Automate can. Use the Office 365 Outlook trigger When a new email arrives (V3) with Only with Attachments set to Yes, loop through the attachments and use the OneDrive for Business or SharePoint Create file action. Standard connectors are included with Microsoft 365 business plans.
Gmail filters cannot save to Drive on their own, but a Google Apps Script can. Label incoming invoices with a filter, and run a script every 15 or 30 minutes that saves attachments from labelled threads to a Drive folder and relabels them. Each run can last up to six minutes under Google's quotas.
Microsoft documents that when Defender for Office 365 Safe Attachments uses Dynamic Delivery, the Outlook trigger may fire twice, the first time with an empty attachments list. Add a condition after the trigger that continues only when the number of attachments is greater than zero, and check for existing files before saving.
It is reasonably safe if you limit it to known senders and safe file types such as PDF, keep attachment scanning on, and save into a folder only finance staff can open. Avoid saving zip, executable, HTML or macro-enabled files, and never let an automation approve or pay invoices.
If the main goal is getting supplier bills into Xero or QuickBooks with amounts and GST read automatically, a receipt-capture tool is usually better than a filing flow. If you mainly want documents stored and findable, including contracts and delivery orders, a Drive or SharePoint flow is simpler and needs no extra subscription.