On a schedule
Back up your Notion databases to Google Drive every night
Each night your Notion databases are saved as files in a dated Drive folder, and you get an email if the backup fails.
- Runs
- On a schedule
- Apps
- Google Drive, Notion
- AI
- Not needed
- Access
- Notion read; drive.file
Send this to your assistant
Create a ClickRuntime automation: every night, export my Notion databases to JSON files in a dated Google Drive folder 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 studio runs its clients, projects and invoices from Notion databases. One accidental bulk delete or a broken import could wipe months of records, and Notion's own history is not something they want to rely on alone.
A nightly copy in Google Drive gives them an independent backup they control. If something goes wrong, yesterday's data is a folder away.
What you get out of it
A copy outside Notion
Your records exist in a second place you control. An accident in one tool does not take the data with it.
Dated snapshots to go back to
Each night gets its own folder. You can recover how a database looked before a mistake was made.
You hear when it fails
An email arrives if a backup does not complete. Silent failures, the usual problem with backups, are avoided.
Peace of mind for client data
Clients and auditors can be told how records are protected. Backups become part of how you work, not a someday task.
How it works
What happens, step by step
Every night, ClickRuntime reads every page of each Notion database on your list.
It creates a folder in Google Drive named with the date.
Each database is saved as its own file in that folder.
If anything fails, you get an email saying which database could not be backed up.
Before it runs live
- Connect Google Drive
- Connect Notion and share the database you want it to use
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 and Notion steps into one automation
Under the hood
The code that runs this automation
import json
from datetime import date
from clickruntime import on_trigger, credentials, http, notify
DATABASES = {"Clients": "notion-db-id-1", "Projects": "notion-db-id-2"}
PARENT_FOLDER = "your-drive-folder-id"
@on_trigger
def run(event):
notion = {"Authorization": f"Bearer {credentials.connection('notion', 'work')}", "Notion-Version": "2022-06-28"}
drive = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
folder = http.post("https://www.googleapis.com/drive/v3/files", headers=drive, json={"name": date.today().isoformat(),
"mimeType": "application/vnd.google-apps.folder", "parents": [PARENT_FOLDER]}).json()["id"]
failed = []
for name, db in DATABASES.items():
try:
pages, cursor = [], None
while True:
r = http.post(f"https://api.notion.com/v1/databases/{db}/query", headers=notion, json={"start_cursor": cursor} if cursor else {}).json()
pages += r["results"]
if not r.get("has_more"):
break
cursor = r["next_cursor"]
http.post("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", headers=drive, files={
"metadata": ("m", json.dumps({"name": f"{name}.json", "parents": [folder]}), "application/json"),
"file": (f"{name}.json", json.dumps(pages), "application/json")}).raise_for_status()
except Exception as e:
failed.append(f"{name}: {e}")
if failed:
notify.email_me("Notion backup failed", "\n".join(failed))
return {"backed_up": len(DATABASES) - len(failed), "failed": len(failed)}FAQ
Common questions
Which databases are backed up?
What format are the backups in?
Will the Drive folder fill up over time?
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
Create a Drive folder and Notion page for each new client
When your onboarding form is submitted, the client gets a Drive folder copied from your template and a Notion client page linking to it.
See how it worksImport contacts from a CSV in Google Drive into Notion
Drop a contacts CSV into your Drive folder and each contact is added to your Notion database, with duplicates skipped.
See how it worksTurn recordings in Google Drive into summarised notes in Notion
Drop an audio recording in your Drive folder and get a Notion page with its summary and action items.
See how it worksKeep exploring
Set up “Back up your Notion databases to Google Drive every night” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.