I have a Jupyter notebook that needs access to a .csv data file. I intend to make these accessible for other people in my group, and I want it to work directly for them too, without the need to change the directory, or manually import data, or even 'save shortcut in drive'.
At the moment both files (.ipynb and .csv) are in the same folder on my drive, but when I share the folder, the data file is not accessible to the other people (the pwd
is set to /content
, and even with mounting the drive, I dont get access to the 'shared with me folder'.
Is there a workaround to allow for direct usage of the .csv file? idealy I just have a cell that copies the csv from the drive to the content folder, but I dont know how to access it:
!cp $where_is_the_folder? data.csv /content
It is very important that the other people don't need to do anything in order to run the notebook.
I also tried the suggestion to use PyDrive and auth as here but it does not seem to work.
At the moment this is the full code, but obviously it only works on my drive, not on others i share it with:
import pandas as pd
from google.colab import drive
drive.mount('/content/drive')
!cp /content/drive/MyDrive/project_folder/data.csv /content
dataFrame = pd.read_csv('/content/data.csv')
note that the notebook and the data.csv are in the same directory (/content/drive/MyDrive/project_folder
)