Back to Blog

Automate Google Sheets Backups to Google Drive

N8nPort
Automate Google Sheets Backups to Google Drive

Activate this automation on N8nPort with one click

We have completed the workflow installation, node configuration, and setup for you, so the automation is ready to activate without a manual import or node-by-node configuration.

Activate on N8nPort

Quick answers

What does this n8n workflow do?

This n8n workflow automates the process of backing up data from a Google Sheet to a Google Drive folder on a predefined schedule, helping you keep your information secure and versioned.

How often can this workflow run?

The workflow is set to run daily at 2 AM by default, but you can easily adjust its schedule to fit your specific backup needs.

What kind of files does this workflow create?

By default, the workflow saves your Google Sheet data as a CSV file in Google Drive, though you have the option to change the output format to XLSX if preferred.

Do I need special access for this workflow?

You will need appropriate Google Sheets and Google Drive credentials set up in n8n, granting the workflow permission to read from your source sheet and write to your destination folder.

Keeping your important data safe and accessible is a key part of managing any project or business. This workflow helps you automatically back up your Google Sheets data to Google Drive on a regular schedule. It reads information from a specific sheet and saves it as a new file in a designated folder, providing a simple way to maintain data redundancy and historical records.

Key Questions About This Workflow

  • What does this n8n workflow do? This n8n workflow automates the process of backing up data from a Google Sheet to a Google Drive folder on a predefined schedule, helping you keep your information secure and versioned.

  • How often can this workflow run? The workflow is set to run daily at 2 AM by default, but you can easily adjust its schedule to fit your specific backup needs.

  • What kind of files does this workflow create? By default, the workflow saves your Google Sheet data as a CSV file in Google Drive, though you have the option to change the output format to XLSX if preferred.

  • Do I need special access for this workflow? You will need appropriate Google Sheets and Google Drive credentials set up in n8n, granting the workflow permission to read from your source sheet and write to your destination folder.

Quick Overview: Scheduled Google Sheets Data Backup

This n8n workflow, originally shared by David Olusola, provides a straightforward solution for regularly backing up your Google Sheets data. It connects to your Google Sheet, extracts the data, and then uploads it as a new file to a specified folder within your Google Drive. This process helps ensure that you have copies of critical business data, supports audit trails, and allows for historical data snapshots without manual effort.

What This Workflow Does

The core function of this workflow is to create scheduled backups of your Google Sheet data. It targets a single sheet within a Google Spreadsheet, reads all its content, and then exports that content into a new file. This new file is then stored in a Google Drive folder that you choose. This automation is useful for anyone who needs to keep regular copies of their spreadsheet data, whether for compliance, disaster recovery, or simply to track changes over time.

How It Works

This workflow uses a sequence of three nodes to achieve its goal:

Daily Backup Schedule (2 AM)

The workflow starts with a Cron node, which acts as a scheduler. By default, this node is configured to trigger the workflow once every day at 2 AM. This means your backup process will run automatically at this set time without you needing to manually start it.

Read Google Sheet Data

Next, a Google Sheets node connects to your specified Google Sheet. It uses your Google Sheets credential to access the document and reads all the data from a particular sheet (or tab) within that spreadsheet. You'll tell this node which specific sheet to read from.

Upload Backup to Google Drive

Finally, a Google Drive node takes the data received from the Google Sheets node. Using your Google Drive credential, it then uploads this data as a new file into a designated folder within your Google Drive. The workflow names the backup file automatically, often including the sheet name and date, and saves it as a CSV by default, though you can change this to XLSX.

Ready to automate?

The complete installation and configuration are already prepared for your workspace. Activate the preconfigured workflow on N8nPort with one click.

Activate the workflow

Prerequisites

Before you can use this workflow, ensure you have the following in place:

  • An active n8n instance.

  • A Google account with access to Google Sheets and Google Drive.

  • Google Sheets Credentials: You'll need to have Google Sheets OAuth2 credentials configured in your n8n instance to allow access to your spreadsheets.

  • Google Drive Credentials: Similarly, you'll need Google Drive OAuth2 credentials set up in n8n to permit file uploads to your drive.

  • Source Google Sheet: Have the Google Sheet you want to back up ready. You will need its Document ID, which can be found in the URL.

  • Destination Google Drive Folder: Create or choose a folder in Google Drive to store the backups. You will need its Folder ID, also found in the URL.

How You Set It Up

Setting up this workflow involves a few steps to connect your Google services with n8n:

Create Google Sheets and Google Drive Credentials

In your n8n instance, go to the 'Credentials' section. You will need to set up two OAuth2 API credentials:

  • Google Sheets OAuth2 API: This credential allows n8n to read data from your Google Sheets.

  • Google Drive OAuth2 API: This credential enables n8n to upload files to your Google Drive.

When setting these up, n8n will guide you through the process of authenticating with your Google account. You will grant n8n the necessary permissions to access your Google Sheets and Google Drive. Remember, you should never expose your actual secret keys or tokens.

Prepare Your Google Sheet and Drive Folder

  • Source Google Sheet: Identify the Google Sheet you intend to back up. Copy its Document ID from the URL (it's the long string of characters in the middle of the sheet's URL). Also, note the exact name of the specific tab (e.g., "Sheet1") you wish to back up.

  • Destination Google Drive Folder: Go to your Google Drive (drive.google.com). Create a new folder specifically for your backups (e.g., "Google Sheets Backups"). Copy the Folder ID from its URL.

Configure the Workflow Nodes

  • Read Google Sheet Data Node: Select your newly created Google Sheets credential. Replace the placeholder YOUR_SOURCE_GOOGLE_SHEET_ID with the Document ID of your source Google Sheet. Also, ensure the sheet name (e.g., "Sheet1") matches the exact name of the tab you want to back up.

  • Upload Backup to Google Drive Node: Select your Google Drive credential. Replace the placeholder YOUR_DESTINATION_GOOGLE_DRIVE_FOLDER_ID with the Folder ID of your Google Drive backup folder. The workflow is set to save files as CSV by default, but you can change the 'File Type' option to XLSX if you prefer an Excel format.

Activate and Test the Workflow

Once configured, click the 'Activate' toggle button to enable the workflow. To test it immediately, click 'Execute Workflow'. After execution, check your Google Drive backup folder. You should see a new file there, typically named something like backup_Sheet1_YYYY-MM-DD.csv.

What You Can Customize

This workflow offers several points for customization to better suit your needs:

  • Backup Schedule: You can modify the Cron node to change when the workflow runs. Instead of daily at 2 AM, you could set it to run weekly, monthly, or at a different time of day.

  • Backup File Type: In the Google Drive node, you can switch the 'File Type' from CSV to XLSX if you prefer your backups to be in an Excel format.

  • Multiple Sheets: While this workflow backs up one sheet, you could extend it to back up multiple sheets by adding more Google Sheets nodes and connecting them to the Google Drive node, or by using a loop structure.

  • Error Notifications: For more useful operations, you could add additional nodes to send notifications (e.g., via email or a messaging app) if the backup process encounters an error.

Limitations and Troubleshooting

This workflow is designed for backing up a single Google Sheet tab at a time. If you need to back up an entire Google Spreadsheet with multiple tabs, you would need to adjust the workflow to iterate through each tab or create separate workflows for each. When troubleshooting, always double-check your Google Sheets Document ID, Google Drive Folder ID, and the exact sheet name. Ensure your Google credentials have the correct permissions to read from the source sheet and write to the destination folder.

Frequently Asked Questions

Find answers to common questions about this Google Sheets backup workflow below.

What data does this workflow back up?

This workflow backs up all data from a single, specified tab within a Google Sheet. It does not back up an entire Google Spreadsheet with multiple tabs unless modified.

Can I change the backup frequency?

Yes, the workflow uses a Cron node for scheduling. You can easily adjust its settings to run daily, weekly, monthly, or at any specific time you prefer.

What file format are the backups saved in?

By default, the workflow saves the backup files as CSV (Comma Separated Values). However, you can change this setting in the Google Drive node to save them as XLSX (Excel spreadsheet) files instead.

How do I specify which Google Sheet to back up?

You specify the Google Sheet by providing its Document ID and the exact name of the tab you want to back up within the 'Read Google Sheet Data' node.

What if the workflow fails?

The provided workflow does not include built-in error notifications. You would need to manually check your Google Drive folder or extend the workflow with additional nodes to send alerts upon failure.

Source and Next Steps

This workflow was originally authored by David Olusola and is available on the n8n.io website. You can find the original workflow and more details at n8n.io/workflows/6469. Explore other workflows on n8n.io to discover more ways to automate your tasks and connect your applications.

Activate this workflow on N8nPort

Choose your workspace and activate the fully prepared automation with one click.

Activate on N8nPort