Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share files with other collaborators in google colab

I know that I can access my google drive files from colab with a code like this:

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

But in this way, only me is able to access data file located on my drive. If I share my colab notebook with someone, how can he/she access to that file? Obviously above code is not applicable for him/her, because he does can't access my account to authorize colab.

like image 816
m.farokhian Avatar asked Dec 29 '19 08:12

m.farokhian


People also ask

How do I use Google colab with other users?

Simply click the Share button at the top right of any Colab notebook, or follow these Google Drive file sharing instructions. If you choose to share a notebook, the full contents of your notebook (text, code, output, and comments) will be shared.

Can you collaborate on Google Colab?

Collaboration. Another great feature that Google Colab offers is the collaboration feature. If you are working with multiple developers on a project, it is great to use Google Colab notebook. Just like collaborating on a Google Docs document, you can co-code with multiple developers using a Google Colab notebook.

How do you share a dataset in Colab?

Scroll down to Open files from Google Drive and click on INSERT. Go to the URL link on your browser to grant access to Colab, copy the authorization code and paste it into the space given in the notebook. You can now access all your datasets on your Drive directly on Colab. Then, you can proceed to work with it.


1 Answers

There are 2 ways.

  1. You share the folder with him. He click the folder and choose "Add to My Drive". It will create a symlink (it won't copy, won't take space). He can now mount it the same way as you, using drive.mount(..).

  2. Share the folder with him. Then access the folder and files within using pydrive, not drive.mount(). You must use the FILE_ID instead of file names to refer to those folder and files.

like image 86
korakot Avatar answered Oct 25 '22 21:10

korakot