Sunday, October 27, 2024

How to use Google Takeout to backup Blogger automatically

Google Takeout is a handy tool for manually backing up Blogger, but it doesn’t support automatic scheduled backups. However, here’s a workaround using Google Takeout with Google Drive and Google Apps Script to automate the backup process periodically. Here’s how to do it.


Step 1 - Create a Google Takeout for Blogger Backup


1. Go to Google Takeout.

2. Deselect everything and select only Blogger.

3. Under Destination, choose Add to Drive and set Frequency to export every 2 months.

4. Finish setting up Takeout to send the Blogger backup directly to your Google Drive automatically.


Step 2 - Use Google Apps Script to Automate Backups More Frequently


1. In Google Drive, create a Google Apps Script to check for the latest Takeout files and back up as often as needed.

• Open Google Apps Script and create a new project.

• Use the following code to check Google Drive for any new Blogger backups.


function backupBloggerFiles() {

    const folder = DriveApp.getFolderById("YOUR_FOLDER_ID"); // Replace with your Google Takeout destination folder ID

    const files = folder.getFilesByType("application/zip");


    while (files.hasNext()) {

        const file = files.next();

        const newFolder = DriveApp.createFolder("Blogger Backup - " + new Date());

        file.makeCopy(file.getName(), newFolder);

    }

}



2. Replace "YOUR_FOLDER_ID" with the ID of your Takeout destination folder.

3. Save and run the script once to authorize it.

4. Set up a time-based trigger to run the backupBloggerFiles function periodically.

• Click on Triggers (clock icon) and set the script to run weekly, daily, or at any other frequency.


Additional Tips


• You can edit the code to email you a notification every time the backup runs.

• Regularly check that your Google Drive storage has enough space for these backups.


This process allows you to create recurring backups of your Blogger content automatically.