Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import Google Drive files shared with/by you in colab

It is rather obvious that this simplest recommended way which also provides the simplest API for reading the files from a drive folder ―

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

― does not allow access to files/folders shared with/by you in Google Drive, but only allows access to your own drive's files, making its use less of a fit for shared notebooks (or at least, shared notebooks that need to access data from shared google drive folders).

Is it possible to access google drive folders shared by/with you using the same API, or any of the other ones which rely on google drive sharing permissions and not "anyone with the link can access" google drive hyperlinks?

I believe all other ways require the use and hard-coding of file id's, whereas the API mentioned above can access drive files by name, which at times can be simpler to maintain.

Can you use the same API for shared Google Drive files?

like image 623
matanster Avatar asked Dec 21 '18 12:12

matanster


1 Answers

A simple solution for shared files is to add them to you Drive by right clicking on the file in the 'shared with me' list in Drive and selecting the 'Add to Drive' item. Afterward, the file will appear in /content/drive/My Drive/

enter image description here

like image 148
Bob Smith Avatar answered Oct 13 '22 18:10

Bob Smith