
Have you ever encountered such a problem?
You’ve built a bunch of automated workflows with n8n (such as sending messages on a schedule, data synchronization, and file processing), but one day the server crashes or you accidentally delete the workflows. All the processes you’ve stayed up late to build are gone?
Or every time you modify the workflow, you have to manually export the JSON backup to the local computer, and you will forget it after a long time.
Today, I’d like to share an n8n workflow – “n8n Workflow Automatic Backup Tool”, which can help you automatically back up all local n8n workflows to Google Drive every day and also supports manual triggering.
What does this workflow do?
Simply put, it has only one core function: to periodically or manually package all your workflows in n8n into JSON files and save them to a specified folder in Google Drive.
Specifically, it can solve three problems:
1. No need to manually back up anymore : It runs automatically at 2:30 every morning, and you don’t need to worry about it throughout the process
2. Lost workflows can be restored instantly : Each workflow is stored as a separate JSON file. If lost, simply download it from Google Drive and import it into n8n
3. Data security is guaranteed : stored in Google Drive, no need to worry about local server failure or accidental deletion of files
How does it work?
The whole workflow is divided into 4 steps, like an assembly line: trigger → pull data → process data → save to Google Drive.
1. When does the backup start?
There are two ways, choose as needed:
- Manual trigger : Click “Execute” on the n8n interface and back up whenever you want (for example, after modifying an important workflow).
- Timed trigger : Automatically run at 2:30 every morning (default configuration, time can also be changed, such as changing to Sunday morning)
2. Pull workflow data from n8n
After the trigger, the first step is to “get the workflow information from n8n”:
- Call the n8n API to pull the “basic information” of all workflows (such as the ID and name of each workflow)
- Then, based on these IDs, pull the “complete configuration” of each workflow one by one (including how the nodes are connected and how the parameters are set – these are the core of the backup)
3. Turn the data into a storable file
Once we pull the data, we need to process it into a format that Google Drive can store:
- Combine the “workflow name” and “full configuration” (e.g., use the name as the file name and the configuration as the file content)
- Convert the JSON configuration into binary data (because the file storage requires binary format)
4. Save to Google Drive
Finally, drop the processed file into Google Drive:
- The file name is the name of the workflow (such as “Customer Information Synchronization.json”), which makes it easy for you to find.
- Automatically save to the Google Drive folder you specify (such as creating a dedicated folder named “n8n Backup”)
Once the whole process is completed, you can open Google Drive and see the JSON backup files of all workflows
How do I configure this workflow?
Preparation (Must Read!)
1. Google Drive API Credentials: To allow n8n to save files to your Google Drive, you need to create an “OAuth Client ID” in Google Cloud and authorize n8n to access it (if you don’t know how to configure it, I’ll provide a tutorial link later)
2. Google Drive target folder ID: Create a new folder in Google Drive (e.g. “n8n workflow backup”), then copy its ID from the browser address bar (the long string after “folders/” in the address bar, e.g.1AbC2dEfG3hIjK4lMnOpQ5rStUvW
)
Configuration steps
Step 1: Configure n8n API access (for the “Get Workflow List” and “Get Workflow” nodes)
Both nodes call the n8n API to pull data and require the following fields to be filled in:
- URL: If n8n is installed locally, the default is `http://localhost:5678/rest/workflows` (if it is deployed on a server, replace it with your n8n domain name, such as `https://your n8n address/rest/workflows`)
- Authentication method : Select “Basic Auth”, then fill in the “username” and “password” of n8n
Step 2: Configure Google Drive upload (Google Drive node)
This node is responsible for saving files to Google Drive. There are three places to change:
- Credentials : Replace the default “test” with the Google Drive credentials you prepared (newly added in the “Credential Management” of n8n)
- File name: default is
{{$node["Merge"].data["name"]}}.json
(use the workflow name as the file name, no need to change) - Target folder ID: Replace the default value in the
parents
field with the Google Drive folder ID you copied.
Step 3: Adjust the trigger time (the “Run Daily at 2:30am” node)
By default, it is triggered at 2:30 am every day. If you want to change the time (for example, change it to 3 am every Monday), click this node and modify the “Cron expression”:
- 2:30 every day:
30 2 * * *
- 3:00 every Monday:
0 3 * * 1
(Don’t know how to write a Cron expression? Search for “Cron expression generator” online for a visual configuration)
After you’ve made these 3 changes, click “Execute” to test it out. If you see the workflow JSON file in your Google Drive destination folder, you’re all set!