Use this robust n8n workflow template to automatically back up all your critical n8n workflows daily to Google Drive, including smart folder cleanup to manage storage space.
Download this n8n workflow template and start using it instantly.
n8n administrators and DevOps teams needing reliable infrastructure backups.
Developers who manage many critical automation flows and require version history.
Maintaining a reliable backup system is crucial for any production automation environment. This sophisticated n8n workflow template solves the problem of manual workflow exports and storage clutter.
It ensures that every active n8n workflow is captured nightly and securely stored in Google Drive. More importantly, it features an intelligent cleanup mechanism. After running the daily backup, the workflow uses n8n nodes to check for existing folders and automatically deletes those older than a specified retention period (default 30 days). This dual-action n8n automation provides peace of mind while preventing excessive storage consumption.
This comprehensive n8n solution is divided into two major phases: Backup and Cleanup.
Schedule Trigger n8n node, running daily at 3 AM. It first consults the configuration n8n node to fetch the Google Drive folder ID and the count of backupsToKeep.Split In Batches n8n node. For each individual n8n workflow, the data is converted to a .json file format. A final Google Drive n8n node uploads this .json file into the newly created daily backup folder.Code n8n node processes the list, sorting folders by creation date and slicing the list to isolate only the excess, old folders based on the configured retention number. These excess folders are then iterated over using a Split In Batches n8n node.To deploy this powerful n8n workflow, follow these steps:
parentFolderId: Paste the ID of the main Google Drive folder where you want all your daily backups to be stored.backupsToKeep: Adjust the number (default is 30) of the most recent backup folders you wish the n8n workflow to preserve.Schedule Trigger is enabled and activate the entire n8n workflow. The next time the n8n trigger fires, the backup process will begin.This n8n workflow utilizes several key n8n nodes for comprehensive automation:
Schedule Trigger / Manual trigger: The starting n8n trigger node that dictates when the backup runs (scheduled daily or manually executed).
CONFIG - Set your variables here (Set n8n node): Stores global variables used throughout the n8n workflow, specifically parentFolderId and backupsToKeep (30 days).
Create new backup folder (Google Drive): Creates a uniquely named folder based on the current date, ensuring organized storage for the new set of n8n templates.
Get all n8n workflows (n8n n8n node): Connects to the local n8n API to retrieve a JSON list containing the details of every single active n8n workflow on the instance. This is essential for the backup process.
Convert workflow to file (Convert To File n8n node): Converts the JSON data for each n8n workflow into a storable binary file with the correct .json extension.
Upload workflow to Google Drive (Google Drive): The final step in the backup phase, uploading the .json file for the current n8n workflow iteration.
Search files and folders (Google Drive): Used in the cleanup path to find all previously created backup folders based on the naming convention.
Sort and isolate old folders (Code n8n node): Contains custom JavaScript to implement the core retention logic, sorting all folders and identifying which ones must be deleted to adhere to the backupsToKeep configuration. This demonstrates the flexibility of n8n nodes for complex logic.
Use this robust n8n workflow to automatically backup all new or updated n8n templates to a GitHub repository, create a Pull Request, and notify your team via Slack.

Use this advanced n8n workflow to automatically backup and version control your n8n workflows to GitHub. Features intelligent change detection, rename support, and optional Telegram reports.

Use this robust n8n workflow template to schedule automatic, reliable backups of all your n8n workflow configurations directly to GitHub, ensuring version control and disaster recovery.

Use this robust n8n workflow to automatically backup all your running n8n templates to Google Drive every 4 hours. Includes Slack notifications for success and failure.








































