Automated Credential Backup to Google Drive - n8n Workflow

Secure your installation using this n8n workflow. Automatically export all decrypted n8n credentials using the Execute Command n8n node and store the backup safely in Google Drive.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • n8n Administrators and DevOps teams managing production instances.

  • Users needing a robust disaster recovery plan for their n8n installation.

  • Individuals who rely on many integrations and require automated credential backups.

  • Anyone looking for advanced n8n templates that utilize system commands.

Overview

Maintaining an n8n instance requires robust backup strategies, especially concerning credentials that secure connectivity to hundreds of third-party services. Losing access to these credentials means rebuilding connections manually—a massive time sink. This crucial n8n workflow solves this by providing a reliable, automated solution.

It utilizes the system-level n8n export:credentials command to pull all decrypted credential data. The flow then processes this raw data and converts it into a clean JSON file, which is instantly uploaded to Google Drive. By setting up the Schedule n8n trigger, you ensure that your backups happen automatically, offering peace of mind and significantly reducing downtime in the event of system failure. This is one of the most essential n8n templates for any serious user.

How it Works

This automation offers two starting points: the Manual n8n trigger (for immediate testing) and the Schedule n8n trigger (for periodic automated execution).


  1. Trigger: The n8n workflow is initiated either manually or according to a defined schedule by the n8n trigger.

  2. Credential Export: The flow uses the Execute Command n8n node to run the npx n8n export:credentials --all --decrypted command, exporting all current n8n credentials in decrypted JSON format.

  3. Data Extraction and Formatting: The raw terminal output is passed to a Code n8n node. This custom script is essential; it parses the stdout, extracts the pure JSON array containing the credential objects, and prepares the data for subsequent processing.

  4. Aggregation: The Aggregate n8n node collects all individual credential items back into a single structure.

  5. File Creation: The Convert To File n8n node takes the aggregated JSON structure and serializes it, creating a binary file buffer named n8nbackupcredentials.json.

  6. Secure Storage: Finally, the Google Drive n8n node uploads the newly created file buffer to the designated backup folder, completing the automated backup of your entire n8n workflow ecosystem's connection data.

Installation Guide

To use this vital n8n workflow template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Credentials Setup:

Google Drive: You must configure a Google Drive credential (OAuth2) that has write access to the desired backup folder.
Execute Command Prerequisite: This n8n workflow requires that your n8n instance environment (e.g., Docker container, host machine) has access to the npx n8n command and the necessary permissions to run system commands, which is often standard for self-hosted n8n setups.

  1. Configure Backup Location: In the Google Drive n8n node, update the Folder ID parameter to point to your specific desired backup location.

  2. Set the Schedule: Activate the Schedule n8n trigger and define how frequently you want the backup to run (e.g., daily, weekly).

  3. Activation: Set the n8n workflow to 'Active' to enable scheduled backups.

Node Details

Schedule Trigger / On Click Trigger: These are the initial n8n trigger points. The Schedule Trigger allows the n8n workflow to run automatically at set intervals, ensuring routine data retention.
Execute Command Get All Cridentials: This core n8n node runs the npx n8n export:credentials --all --decrypted command. This command is the mechanism for pulling all stored credentials from the n8n database, making this n8n node central to the backup process.
JSON Formatting Data (Code): A custom Code n8n node that handles the messy output of the terminal command. It uses JavaScript to find the exact JSON array structure within the stdout and parses it into usable data items for the next steps in the n8n workflow.
Aggregate Cridentials: This n8n node is crucial for restructuring the data. After the Code node separates the credentials, Aggregate combines all items back into a single object, preparing them to be written into a single file.
Convert To File: Configured to use the toJson operation, this n8n node takes the aggregated JSON data and creates a binary file object named n8nbackupcredentials.json.
Google Drive Upload File: The final n8n node in this process. It takes the binary file created by the Convert To File n8n node and securely uploads it to a specified folder in your Google Drive account, ensuring the integrity of the n8n templates and connection data.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

A Growth Hacker, Digital Marketer & AI Automation Builder with 10+ years of experience in Digital Marketing & Workflow Automation. Based in Helsinki, Finland. For questions about my templates and customization, contact me at: [email protected]

Featured*