Daily
Back up an export to OneDrive every night
A dated copy of your data export is saved nightly, older copies are pruned, and you hear if it fails.
- Runs
- Daily
- Apps
- OneDrive
- AI
- Not needed
- Access
- read+write (Files.ReadWrite)
Send this to your assistant
Create a ClickRuntime automation: every night at 2am, download the file from https://example.com/export.csv into OneDrive Backups named with today's date, keep 30 days of copies, and email me if it fails.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A small ecommerce store exports its orders, customers and product list from its platform every night, but the CSV files sit in the Downloads folder of one laptop. If that laptop dies, or the platform account is locked, the business has no recent copy. Meanwhile some people save backups to OneDrive by hand, which means two or three copies a month and a folder full of files named final_v2_REAL.csv.
Each night, the export is downloaded from the source URL and uploaded to OneDrive in a dated path, such as Backups/2026/10/orders-2026-10-19.csv. Copies older than 30 days are then deleted so the folder does not grow forever, and an email is sent only if something fails.
It suits stores, agencies and clinics with a data export that nobody wants to back up manually.
What you get out of it
A recent copy survives a disaster
If a platform locks your account or a laptop is stolen, last night's export in OneDrive lets you carry on the next morning, not rebuild from memory. That is far better than discovering during an emergency that your last backup was taken three months ago.
Thirty days of history to roll back to
Finding that a price list was corrupted two weeks ago is far less alarming when a copy from before the damage is a click away. That window is long enough to catch problems that are not noticed at once but still recent enough to be useful.
Storage stays under control
Deleting files older than the cutoff keeps the backup folder at a predictable size, rather than eating through the plan's quota over months. It also means that an old folder of backups will not trigger a surprise storage upgrade.
Silence means success
An email only on failure means that no news is good news. You are not trained to ignore a daily message that says everything is fine. A quiet inbox on normal days means the failure email gets read, which is the reason you want it.
Neat paths make restores simple
Year and month folders with date-stamped names mean you can reach the right file without opening each one to check its contents. In an emergency, a clearly named file that is easy to locate saves time you do not have.
How it works
What happens, step by step
Every night, ClickRuntime downloads your data export.
It saves a copy to OneDrive with the date in the file name.
Copies older than 30 days are deleted, so your backups do not pile up.
If anything goes wrong, you get an email with the error. When the backup works, it stays quiet.
Before it runs live
- 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
- Run it at a different time, more or less often, or only on weekdays
- 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 OneDrive steps into one automation
Under the hood
The code that runs this automation
from datetime import date, datetime, timedelta, timezone
from clickruntime import on_trigger, credentials, http, notify
GRAPH = "https://graph.microsoft.com/v1.0"
EXPORT_URL = "https://app.example.com/export.csv"
FOLDER = "Backups"
KEEP_DAYS = 30
@on_trigger
def run(event):
try:
h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
data = http.get(EXPORT_URL, headers={"Authorization": f"Bearer {credentials.secret('EXPORT_TOKEN')}"}, timeout=120).content
http.put(f"{GRAPH}/me/drive/root:/{FOLDER}/export-{date.today()}.csv:/content", headers=h, data=data).raise_for_status()
cutoff = (datetime.now(timezone.utc) - timedelta(days=KEEP_DAYS)).isoformat()
old = [f for f in http.get(f"{GRAPH}/me/drive/root:/{FOLDER}:/children", headers=h).json()["value"] if f["createdDateTime"] < cutoff]
for f in old:
http.delete(f"{GRAPH}/me/drive/items/{f['id']}", headers=h)
return {"bytes": len(data), "pruned": len(old)}
except Exception as e:
notify.email_me("Backup failed", f"{type(e).__name__}: {e}")
raiseFAQ
Common questions
What happens if the nightly export fails?
Can the retention period be 90 days instead of 30?
What sources can be backed up this way?
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
Archive old files from a temp folder weekly
Files that have sat untouched for months move to Archive, and you get a list of what moved.
See how it worksRefresh a workbook in OneDrive every day
A workbook stored in OneDrive gets fresh values daily and you get the new total.
See how it worksGet a weekly OneDrive storage report
Each Monday you see how much storage you're using and which files changed last week.
See how it worksKeep exploring
Set up “Back up an export to OneDrive every night” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.