On a schedule
Back up your data to Drive every night
Each night your data is saved to a dated Drive folder, and backups older than 30 days go to trash.
- Runs
- On a schedule
- Apps
- Google Drive
- AI
- Not needed
- Access
- read+write (drive.file is enough if ClickRuntime created the folders)
Send this to your assistant
Create a ClickRuntime automation: every night at 2am, export all records from this API as JSON into a new dated folder in my Backups Drive folder, and move backups older than 30 days to trash.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A founder runs a customer portal on a hosted service that exports data through an API: users, orders, support tickets. The service keeps its own backups, but they live in the same account and cannot be restored on demand. The only copy she controls is the one someone remembers to download by hand. If the account is suspended or a bad import overwrites records, she has nothing to go back to, and old exports pile up in Drive when they are made.
Every night, ClickRuntime calls the source API and fetches the export, creates a Drive folder named with the date, and uploads each JSON file into it. After the upload it lists the dated folders and moves those older than 30 days to the trash, so the archive keeps a rolling month without growing forever.
It works for any tool with an export endpoint, including CRMs, billing platforms and helpdesks.
What you get out of it
A copy you hold yourself
Provider backups sit behind the provider's login and rules. A dated copy in your own Drive means you can still reach your customer and order records if an account is locked or a vendor has an outage.
Recover from bad imports and deletes
A mistaken bulk update can overwrite thousands of rows before anyone spots it. With a folder for each night, you can look back to the last good day and see exactly what the data looked like.
Storage use stays predictable
Deleting backups older than 30 days stops the archive from growing indefinitely. You keep a month of history at a roughly constant size, instead of finding a year of exports in a quota alert.
Easy to hand to an auditor
Dated folders with identical file names make it simple to show an auditor or a buyer's due diligence team that your data is exported regularly and that retention is managed deliberately.
No weekly download chore
A manual export depends on whoever remembers it, and it is the first task dropped in a busy week. A scheduled run takes that dependency away, and the nightly pattern is the same during holidays.
How it works
What happens, step by step
Every night ClickRuntime downloads a full export of your app's records.
It saves the export as a file in a new Google Drive folder named with today's date.
Backup folders older than 30 days are moved to the trash, so Drive doesn't fill up.
You end up with a rolling month of dated backups in your Backups folder.
Before it runs live
- Connect Google Drive
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 Google Drive steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import json
from datetime import datetime, timedelta, timezone
from googleapiclient.http import MediaInMemoryUpload
from clickruntime import on_trigger, credentials, http
BACKUPS_FOLDER = "your-backups-folder-id"
API_URL = "https://api.example.com/v1/records"
@on_trigger
def run(event):
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
records = http.get(API_URL, headers={"Authorization": f"Bearer {credentials.secret('APP_API_KEY')}"}).json()
today = datetime.now(timezone.utc).strftime("%Y-%m-%d")
folder = drive.files().create(body={"name": today, "mimeType": "application/vnd.google-apps.folder",
"parents": [BACKUPS_FOLDER]}, fields="id").execute()
drive.files().create(body={"name": "records.json", "parents": [folder["id"]]},
media_body=MediaInMemoryUpload(json.dumps(records).encode(), "application/json")).execute()
cutoff = (datetime.now(timezone.utc) - timedelta(days=30)).isoformat()
old = drive.files().list(q=f"'{BACKUPS_FOLDER}' in parents and createdTime < '{cutoff}' and trashed = false",
fields="files(id,name)").execute()["files"]
for f in old:
drive.files().update(fileId=f["id"], body={"trashed": True}).execute()
return {"saved": len(records), "trashed": [f["name"] for f in old]}FAQ
Common questions
Are deleted backups gone for good?
Can it back up more than one source?
Is the backup encrypted?
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
Keep your uploads folder sorted
New files get a dated name and move into folders by type, and duplicates are reported to you.
See how it worksArchive a website to Drive as Markdown
Each page of a site is saved in Drive as a Markdown file you can read or reuse.
See how it worksCopy new SFTP files into Drive
New files on your FTP or SFTP server are copied into Drive every hour.
See how it worksKeep exploring
Set up “Back up your data to Drive every night” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.