Csv file not found error in Google colaboratory notebooks

google-colaboratory

I am trying to load csv file stored in google drive to colab notebooks. When i try to load the file it is showing "File not found". What is the procedure to load files stored in google drive to colab notebooks??

Best Answer

easiest way I found is mounting google drive in colab:

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

then use '/content/gdrive/My Drive/' as prefix of the file path. suppose you have a text file in data directory of you google drive. Then you can access it with following code:

open('/content/gdrive/My Drive/data/filename.txt').read()
Related Topic