0

I have a csv file stored in my Google Drive. When I open it in Colab, it opens like the picture below. Colab seems to think it is a html file. What should I do? For your reference, I know I can open it with PyDrive, but PyDrive requires authentication each time and so I need another way.

df = pd.read_csv('https://drive.google.com/file/d/ 
                 /1c-j4nEO9Pn3E-zf5is5Py3OTG8pXDdrj/view?usp=sharing',
                 encoding='cp949', nrows=100)

enter image description here

tony lee
  • 35
  • 5

1 Answers1

0

I found that I can connect to Google Drive from Colab without another authentication after the first.

First authentication is done like this: https://stackoverflow.com/a/52300696/13474735

After that you can access your Google Drive with these codes:

from google.colab import drive
drive.mount('/content/drive')
df = pd.read_csv('/content/drive/My Drive/xxxx.csv')
tony lee
  • 35
  • 5