Every 15 minutes
Save email attachments to OneDrive and log them in Excel
Attachments from your inbox are saved to OneDrive and each one is listed in an Excel log you can filter and search.
- Runs
- Every 15 minutes
- Apps
- Microsoft Excel, OneDrive
- AI
- Not needed
- Access
- Mail.Read, Files.ReadWrite
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, save attachments from new Outlook emails to my OneDrive Attachments folder and add a row for each to the Files table in my Excel log.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Bookkeepers and office managers receive receipts, statements and signed documents by email all day and need to prove later what came in and when. Saving them by hand is slow, and email search is no substitute for a proper list.
Saving every attachment to OneDrive and logging it in Excel gives you both the file and an index: who sent it, the subject, the date and a link, ready to filter at month end.
What you get out of it
An index you can filter
The Excel log lists every file with sender and date. Month-end checks become a filter, not a search.
Files safely stored
Attachments are saved in OneDrive, outside the mailbox. Clearing old email doesn't lose documents.
Links straight to the file
Each row includes a link to the saved file. One click opens it.
Hands off
It runs every 15 minutes without anyone opening Outlook.
How it works
What happens, step by step
Every 15 minutes it looks for new emails with attachments in Outlook.
Signature images and other inline pictures are skipped.
Each attachment is saved to your OneDrive Attachments folder.
A row with the date, sender, subject, file name and link is added to your Excel log.
It remembers the newest email it handled, so nothing is saved twice.
Before it runs live
- Connect Microsoft Excel
- Connect OneDrive
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Microsoft Excel and OneDrive steps into one automation
Under the hood
The code that runs this automation
GRAPH = "https://graph.microsoft.com/v1.0"
import base64
from clickruntime import on_trigger, credentials, http, state, report_fetched
LOG = "/me/drive/root:/Attachments/log.xlsx:/workbook/tables/Files/rows/add"
@on_trigger
def run(event):
h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
since = state.get("since") or "2026-01-01T00:00:00Z"
msgs = http.get(f"{GRAPH}/me/messages", headers=h, params={"$filter": f"hasAttachments eq true and receivedDateTime gt {since}",
"$orderby": "receivedDateTime", "$select": "id,subject,from,receivedDateTime"}).json()["value"]
report_fetched(len(msgs))
if not msgs:
return {"summary": "Nothing new"}
rows = []
for m in msgs:
for a in http.get(f"{GRAPH}/me/messages/{m['id']}/attachments", headers=h).json()["value"]:
if a.get("isInline") or "contentBytes" not in a:
continue
item = http.put(f"{GRAPH}/me/drive/root:/Attachments/{m['receivedDateTime'][:10]} {a['name']}:/content",
headers=h, data=base64.b64decode(a["contentBytes"])).json()
rows.append([m["receivedDateTime"][:16], m["from"]["emailAddress"]["address"], m["subject"], a["name"], item.get("webUrl", "")])
if rows:
http.post(f"{GRAPH}{LOG}", headers=h, json={"values": rows}).raise_for_status()
state.set("since", msgs[-1]["receivedDateTime"])
return {"saved": len(rows)}FAQ
Common questions
Which emails are included?
Are inline images saved?
What columns does the log have?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Import new CSV files into an Excel table
When a CSV lands in your OneDrive folder, its rows are added to your Excel table automatically.
See how it worksCombine Excel files from OneDrive into one workbook
Every 15 minutes, rows from new Excel files dropped in a OneDrive folder are added to a table in one master Excel workbook, with the source file name on each row.
See how it worksAdd form responses to an Excel workbook
Every form submission is added as a row in your Excel workbook on OneDrive, with an email so you see it straight away.
See how it worksKeep exploring
Set up “Save email attachments to OneDrive and log them in Excel” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.