What This Automation Does
This n8n workflow helps you save your workflow backups on Google Drive automatically.
It fixes the problem of messy backup files by creating two folders, saving new backups, moving old backups to another folder, and deleting very old backups after 30 days.
You get organized backups without having to do anything manually.
What You Need to Use This Workflow
- Google Drive account with OAuth2 credentials set in n8n.
- n8n instance with an API Key to fetch workflow data.
- n8n version 1.67.1 or newer.
- The workflow will create
n8n_backupsandn8n_oldfolders if missing. - Basic n8n knowledge and access to the editor.
- Optional: Use a self-host n8n setup for full control.
How This Workflow Works: Inputs, Processing, Outputs
Inputs
- Scheduled time trigger to start the backup.
- Google Drive existing folders list.
- Current workflows retrieved from n8n API.
- Current backup files in Google Drive folder.
Processing Steps
- Check for folders named
n8n_backupsandn8n_old. Create if not found. - Move existing backup files from
n8n_backupston8n_old. - Fetch all workflows from n8n.
- Convert each workflow’s JSON data into a file and upload it to
n8n_backupswith clear names. - Delete backup files older than 30 days from
n8n_oldperiodically.
Outputs
- Two Google Drive folders for backups organized by age.
- Latest workflow backups saved as JSON files.
- Old backups archived separately.
- Automatic cleanup of backups older than 30 days.
Beginner Step-by-Step: How to Use This Workflow in Your n8n Production
Step 1: Download and Import the Workflow
- Click the Download button on this page to get the workflow file.
- Open your n8n editor where you have workflows.
- Use the Import feature and choose “Import from File” to upload the downloaded workflow.
Step 2: Configure Workflow Credentials and Settings
- Add your Google Drive OAuth2 credentials in the imported workflow’s Google Drive nodes.
- Add your n8n API Key in the n8n node to allow fetching workflows.
- Check folder names or IDs if you want to customize; otherwise, keep default
n8n_backupsandn8n_old.
Step 3: Test and Activate
- Run the workflow once manually in the editor to confirm backups are created and folders made.
- Look at execution results to check for errors or missing files.
- When happy, activate the workflow to run on schedule automatically.
The workflow will run nightly or at your chosen interval to organize backups without your help.
Customizations You Can Make
- Change backup timing by updating the Schedule Trigger node’s interval.
- Adjust backup retention by changing the deletion time from 30 days to any number.
- Change file naming in the Move Binary Data node with expressions for easier identification.
- Add email alerts after backup or purge to get notified.
- Add extra cloud storage options like Dropbox or AWS S3 to save backups in more places.
Troubleshooting Common Problems
File not found when moving backups
Check if file IDs passed to the move nodes are correct from the latest file list.
Backup folders not created
Verify the Code node correctly checks for missing folders and Google Drive create folder nodes are set up right with exact names.
Upload fails due to data format
Ensure the Move Binary Data node converts JSON data to binary correctly and names files properly before upload.
Pre-Production Checks
- Confirm Google Drive credentials are authorized.
- Make sure the n8n API Key has permission to list workflows.
- Check Schedule Trigger nodes are set to active and run at right intervals.
- Test by deleting backup folders and running workflow to see folders created anew.
- Run a backup test and confirm files upload with correct naming.
- Simulate purge by changing deletion time and verify old backups delete.
Deployment Guide
Activate the workflow once set up and tested.
Monitor runs via the n8n execution log to be sure backups and moves complete successfully.
The schedule triggers run backups and cleanups automatically, so no manual work is needed.
Add logging or alerts if wanted to track the backup status and errors.
Renew credentials when required; otherwise, it works with low maintenance.
Summary
✓ Saves time by automating backup creation and cleanup.
✓ Keeps backup files organized in separate folders.
✓ Deletes backups older than 30 days automatically.
→ Results in easy-to-find, up-to-date backups on Google Drive.
→ Prevents storage clutter and accidental data loss.
