Skip to content

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.

Paste it into your assistant. It tells you what it will send or change before it runs live.

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

  1. Every 15 minutes it looks for new emails with attachments in Outlook.

  2. Signature images and other inline pictures are skipped.

  3. Each attachment is saved to your OneDrive Attachments folder.

  4. A row with the date, sender, subject, file name and link is added to your Excel log.

  5. It remembers the newest email it handled, so nothing is saved twice.

Before it runs live

  • Connect Microsoft Excel
  • Connect OneDrive

What you get

RunsEvery 15 minutes
Save email attachments to OneDrive and log them in Exceltoday, 9:00Succeeded
Excel · Files log2026-10-19 · accounts@northwind.example · September statement · statement-sep.pdf

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
save_email_attachments_to_onedrive_with_an_excel_log.pyexample
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?
All new emails with attachments in your inbox, or only those from senders or with subjects you choose.
Are inline images saved?
No. Inline images like signature logos are skipped.
What columns does the log have?
Date, sender, subject, file name and a link to the file. You can add more columns for your own notes.
What permissions does it need?
Mail.Read, Files.ReadWrite. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

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.