Search code examples
google-colaboratory

Google Colab files are gone


Just spent like 8 hours coding in colab. I coded many python files and saved them on this files tab, under sample data but not in sample data. Got off and came back reopened the browser and all my files are gone!

Please help.

enter image description here


Solution

  • I guess this question is more about venting, right?!

    Because there is nothing to do, as far as I know.

    Obvious tip for next time, use Google Drive to store your scripts.

    Playground only provides temporary session, so in order to save any changes, notebook files must be saved.

    The easiest way to save Colab notebook is to save it in your Google Drive. Click File > Save a copy in Drive. Once you saved a copy of this tutorial, you can open it from your Google Drive or Colab dashboard

    To mount Google Drive, run the below code and go to the link to retrieve the authorization code

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

    Once mounted successfully, your entire Google Drive files should be accessible under /content/gdrive/My\ Drive/

     !ls /content/gdrive/My\ Drive
    

    How to use Google Colab