Google Takeout gives your data to download. In this blog, we will make sense of the data. Table of Contents Downloading Data Downloading Data Go to Google Takeout page. Select the data types you want ...
Google Takeout gives your data to download. In this blog, we will make sense of the data.
Table of Contents
Downloading Data import pathlib import zipfile import os def sanitize_path(path): # Remove invalid Windows characters and strip trailing spaces invalid_chars = '<>:"/\\|?*' for char in invalid_chars: path = path.replace(char, '_') return path.strip() # Paths source_dir = pathlib.Path(r"F:\google-takeout-orig - Copy") unzip_root = pathlib.Path(r"F:\takeout-unzipped") unzip_root.mkdir(parents=True, exist_ok=True) # Process each zip file for zip_file in source_dir.glob("*.zip"): try: dest_dir = unzip_root / zip_file.stem dest_dir.mkdir(parents=True, exist_ok=True) with zipfile.ZipFile(zip_file, 'r') as zip_ref: for member in zip_ref.infolist(): try: # Create sanitized path original_path = pathlib.Path(member.filename) sanitized_parts = [sanitize_path(part) for part in original_path.parts] safe_path = dest_dir.joinpath(*sanitized_parts) # Create parent folders safe_path.parent.mkdir(parents=True, exist_ok=True) if not member.is_dir(): # Extract the file with zip_ref.open(member) as source, open(safe_path, "wb") as target: target.write(source.read()) except Exception as e: print(f"Error extracting {member.filename}: {e}") # print(f"Unzipped: {zip_file.name} to {dest_dir}") except Exception as e: print(f"Error processing {zip_file.name}: {e}") print("All zip files have been processed.")
- Go to Google Takeout page.
- Select the data types you want to download.
- Choose the export frequency, file type, and size.
- Click on "Create Export".
- Wait for the export to be prepared and download the file.
- Download the data. For me over 10 years of Google data, it was 60 files to download. So make sure you are on good internet connection.
- It was 180 GB of data for me. and each file around 3-4 GB.
- Below code will help you to unzip all files in one go.
After unzipping, you will see multiple folders for each datatype like Mail, Photos, Contacts etc. Photos will be repeated in albums vs year albums. they dont have metadata as well, and meta data is in json files.