How to Connect Google Colab with Google Drive (2025 Detailed & Updated Guide)

Google Colaboratory (Colab) remains one of the most accessible platforms for developing and running Python notebooks with free access to GPUs and TPUs. Now with significant AI-first enhancements and improved usability, integrating Google Drive with your Colab workflow is easier and more powerful than ever.

What is Google Colab?

Google Colab is a cloud-based Jupyter notebook environment from Google that provides free access to powerful computing resources, including GPUs and TPUs. It supports most major deep learning frameworks right out of the box (like TensorFlow and PyTorch), and integrates easily with Google Drive for seamless data and notebook storage.

Why Connect Colab with Google Drive?

  • Persistent Data Storage: Files and notebooks stored in your Colab runtime are erased when your session ends. Mounting Google Drive ensures your data persists and is accessible across sessions.
  • Effortless Data Sharing: Easily collaborate and share large datasets or projects with teammates.
  • Access to Large Datasets: Upload data once to Drive, then access it from multiple Colab sessions without repeated uploads.

Step-by-Step: Mounting Google Drive in Colab (2025)

Option 1: One-Click GUI Method

  1. Open your Colab notebook.
  2. Locate the file explorer panel: Click the folder icon on the left sidebar.
  3. Click the Google Drive icon within the file explorer.
  4. Select “Connect to Google Drive”.
  5. Authorize access: You’ll be prompted to log into your Google Account and permit Colab to access your Drive. Grant the necessary permissions.
  6. Success! Your Drive files now appear in the file explorer, under /content/drive/My Drive/ (or /content/drive/Shared drives/).

Option 2: Classic Python Code Method

Paste this code into a notebook cell and run it:

pythonfrom google.colab import drive
drive.mount('/content/drive')
  • Authorize: Follow the prompted link, copy the authorization code, and paste it into the Colab prompt.
  • Drive Mounted: Your Google Drive is now accessible at /content/drive/.

Notes for Best Practice

  • Check current directory: python!pwd
  • Change working directory if needed: python%cd /content/drive/MyDrive/
  • When to re-mount: Each time you start a new runtime/session, you’ll need to repeat the mounting step for security reasons.

Additional Tips & Updates (as of August 2025)

AI-First Enhancements in Colab

  • The latest Colab integrates AI-powered code assistants (from Gemini models) directly in the notebook, helping you debug, refactor, and analyze data even faster.
  • Data Science Agent (DSA), fully embedded as of 2025, assists with dataset exploration, code generation, and code refinement—all accessible via conversational commands within the notebook.

Google Drive Integration: Pros & Cons

MethodProsCons
Full Drive MountingAccess all Drive files, persistent storageMust re-mount on each session, security popup
Upload Files (via File Browser)Quick, one-off uploadsFiles erased after session ends
gsutil/Cloud Storage (Enterprise)Better for large-scale, enterprise projectsRequires Google Cloud setup
  • For multi-file projects and larger datasets, Drive mounting is recommended.
  • For quick demos or smaller files, direct uploads to Colab’s runtime are sufficient.

GPU & TPU Support (2025)

  • GPU: Still freely available in Colab (with increased quotas for Colab Pro/Pro+ users). Supports TensorFlow, PyTorch, and more.
  • TPU: Designed for TensorFlow and JAX, TPUs offer high-speed neural network training, though recent updates have seen a restriction in free-tier performance.
  • Colab Pro/Enterprise: Paid tiers provide more powerful hardware, longer session times, and higher storage limits—a recommended option for heavy users or classes.

Summary

Mounting Google Drive in Colab (2025) is easier and more integrated—now featuring a file browser, one-click connect, and deep AI integration for collaborative and efficient workflows. For persistent data, large datasets, or team collaboration, always use Drive mounting. With full GPU and (optionally) TPU support, Colab remains a top free choice for machine learning and data science projects.

Happy Coding & Deep Learning!

+ posts

Michal Sutter is a data science professional with a Master of Science in Data Science from the University of Padova. With a solid foundation in statistical analysis, machine learning, and data engineering, Michal excels at transforming complex datasets into actionable insights.