Import Google Drive files shared with/by you in colab

时间秒杀一切 提交于 2019-12-11 04:37:48

问题


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?


回答1:


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/



来源:https://stackoverflow.com/questions/53884509/import-google-drive-files-shared-with-by-you-in-colab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!