Nightly n8n backup to Google Drive
Description This template creates a nightly backup of all n8n workflows and saves them to a Google Drive folder. Each night, the previous night's backups are...
🔌 Nodes & Integrations Used (4)
📖 Implementation & Setup Guide
Description
This template creates a nightly backup of all n8n workflows and saves them to a **Google Drive** folder. Each night, the previous night's backups are moved to an **“n8n_old”** folder and renamed with the corresponding date.
Backups older than a specified age are automatically deleted using a precise code-based verification. This ensures your cloud storage remains organized without manual intervention.
What's New in v5 (Optimized)
* **Lightning-Fast Search:** Optimized Google Drive nodes with specific queries (`name contains 'n8n_'`) and limits. This prevents the workflow from scanning your entire Drive, reducing execution time from minutes to seconds. * **Dynamic ID Mapping:** Updated the **Code node** to map folder IDs on the fly. The workflow now "remembers" IDs for `n8n_backups` and `n8n_old`, allowing for seamless transitions even if folders are newly created. * **Modernized Loops:** Fully migrated from legacy "Split In Batches" to the modern **"Loop Over Items"** architecture for better stability and readability. * **Smart Purge Logic:** Uses a Javascript-based **Code node** (`you can delete`) to extract timestamps from filenames and strictly delete files older than 30 days. * **Auto-Healing Infrastructure:** Intelligent check-and-create logic. If the system detects a missing folder, it creates it and immediately passes the new ID to the rest of the flow.
Prerequisites
* **Google Drive Account:** OAuth2 credentials required. [Console Cloud Setup](https://console.cloud.google.com/apis/credentials/oauthclient/) * **n8n Version:** Recommended **v1.70.1** or higher (Required for modern Loop nodes). * **n8n API Key:** Required for the "Get many workflows" node to fetch your local data. [API Key Guide](https://witmovil.com/where-to-create-the-api-key-in-n8n/) * **Permissions:** Ensure the Google Drive API is enabled in your Google Cloud Project.
Configuration
- **Credentials:** Update all Google Drive nodes with your OAuth2 credentials and the "Get many workflows" node with your n8n API Key.
- **Folder Detection:** The "GET CURRENT FOLDER" node is pre-configured to find folders starting with `n8n_`. Do not rename the base folders unless you update the search query.
- **Dynamic Paths:** The node "MOVE INTO OLD FOLDER" now uses a smart fallback expression:
- `{{ $node["Code"].json.ids.n8n_old || $node["Create n8n_old"].json.id }}`
- This ensures it always finds the correct destination.
**Automated Purge Settings:**
- **Retention Policy:** Open the **"you can delete"** Code node. You can modify `const THIRTY_DAYS_IN_MS` to change your retention period.
- **Activation:** Enable the **"PURGE DAYS"** Schedule Trigger (set to 30 days by default) to start the cleanup cycle.
Last updated
March 2026 (v5.2 Optimized)
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Nightly n8n backup to Google Drive.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related General Automation Workflows
View All in General Automation →Generate Application Copy
Production-ready n8n automation template for Generate Application Copy built by AhiXLight. Seamlessly connects Execute Workflow Trigger, OpenAI with 4 configured nodes.
2-way sync Google Contacts and Notion
Sync your Google Contacts with your Notion database. You can filter contacts by label or sync all contacts. All contact information is kept in sync between G...
2D Image to 3D Model Automation
Production-ready n8n automation template for 2D Image to 3D Model Automation built by AhiXLight. Seamlessly connects HTTP Request, Google Sheets, Google Drive with 17 configured nodes.
2 way sync assignments completion between Canvas LMS and Notion
Syncs assignments and completion states to and fro between Canvas LMS and a Notion database. Automatically triggers every 2 hours during the schoolday by def...