Skip to content

Instantly share code, notes, and snippets.

@kashyapmanu
Created March 14, 2021 06:30
Show Gist options
  • Save kashyapmanu/9e15e65389acb790fc3d19d5953ea283 to your computer and use it in GitHub Desktop.
Save kashyapmanu/9e15e65389acb790fc3d19d5953ea283 to your computer and use it in GitHub Desktop.
Python code to download the files from google drive to kaggle
# Install gdown
#! conda install -y gdown
#Run the above code if gdown is not installed.
"""
Get shareable link : -
https://drive.google.com/file/d/1-9XVOJSkXy0L894wAh5dC16MzL5Zt0Wk/view?usp=sharing
Add the file id's (1-9XVOJSkXy0L894wAh5dC16MzL5Zt0Wk) of the file to url list.
Name for your file
"""
url = ['1-9XVOJSkXy0L894wAh5dC16MzL5Zt0Wk']
name=['train_feature']
import gdown
#Crate a folder to store the files
!mkdir feature_trends
for i in range(len(url)):
output = "./feature_trends/"+name[i]
print('https://drive.google.com/uc?export=download&id='+url[i])
gdown.download('https://drive.google.com/uc?export=download&id='+url[i], output, quiet=False)
"""
Credit : https://www.kaggle.com/rsinda/downloading-data-from-google-drive
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment