3

How can I view files that exist in a shared folder on Google Drive? I have tried:

from google.colab import drive
drive.mount("/content/gdrive")
os.listdir("/content/gdrive/My Drive/")

but I cannot see the folder that was shared with me. The folder was created by another person and I have edit abilities on the folder but am not the owner. In Google Drive the folder does not appear under the "My Drive" section but instead is under the "Shared with me" section. Is it still possible to access the contents in Colab?

CrashingWater
  • 181
  • 2
  • 12

2 Answers2

2

Click on the folder and then click on an option that says "Add to My Drive." The shared folder should now be visible in Google Colab.

CrashingWater
  • 181
  • 2
  • 12
  • 1
    What about the shared data that you're not allowed to add to "My Drive"? As I am able to add only a shortcut to the data to "My Drive". The shortcut however does not help loading the data to colab. – Zeeshan Ali Apr 23 '20 at 17:41
  • @ZeeshanAli I have the same problem : https://stackoverflow.com/questions/61525486/accessing-shared-with-me-files-from-google-colab-y2020-previous-solutions-se Did you find a solution ? – Alexander Chervov May 01 '20 at 20:35
  • @ZeeshanAli it seems I found the reason for the problem - https://stackoverflow.com/a/61560765/625396 – Alexander Chervov May 02 '20 at 14:22
0

Right Click on the Shared Folder in Colab and Select option "Add shortcut to Drive"

Then proceed to your google colab workbook and type

from google.colab import drive

drive.mount('/content/drive')

Your drive gets mounted and you can trace your shared folder there. Locate your files and copy their file path and bring them to colab for exercises.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Prasad K
  • 31
  • 5