Save Any File From Google Colab To Your Google Drive

A tutorial on how to save an output file from google colab to your google drive

Tapashree Pradhan
2 min readAug 14, 2023

Working on an ML project in Google Colab? Here’s a step-by-step guide to saving your outputs to a desired google drive folder!

Step 1: Mount your google drive into the content folder of the VM that you’re working with.

from google.colab import drive
drive.mount('/content/drive')

Step 2: Authorise Google Colab to Load your Google Drive next.

Step 3: Create a folder on your drive where you want to save the output.

Step 4: Right-click on the folder and select the “Copy Path” option.

Step 5: In the final cell, enter the following code to save it at the destination:

# save pipe.pkl to output data folder
!cp <output-file-name> /content/drive/MyDrive/<destination-folder-name>

That’s it, and thank you for reading. You’re welcome to connect with me :)

LinkedIn: https://www.linkedin.com/in/tapashree-pradhan/

--

--

Tapashree Pradhan

Computational Materials Science | Scientific & High Performance Computing