Skip to content

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.

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

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

  1. Every night, ClickRuntime reads every page of each Notion database on your list.

  2. It creates a folder in Google Drive named with the date.

  3. Each database is saved as its own file in that folder.

  4. 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

RunsOn a schedule
Back up your Notion databases to Google Drive every nighttoday, 9:00Succeeded
Email · Backup alertNotion backup failed. Projects: database not shared with the connection.

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

  • 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

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.
back_up_notion_databases_to_drive.pyexample
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?
The databases you list, as long as they are shared with your Notion connection. Add a database to the list to include it.
What format are the backups in?
One JSON file per database with every page and its properties. It can be read by scripts or converted to a spreadsheet.
Will the Drive folder fill up over time?
Each backup is usually small, but you can keep only the last 30 nights by deleting older folders, either by hand or as part of the run.
What permissions does it need?
Notion read; drive.file. 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 runs (on a schedule). Checks that find nothing to do 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 “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.