Guide: How to download files from GDrive to a Gradient notebook

If you need to download a dataset or file from Google Drive to your Gradient Notebook using Jupyter please follow these steps:

  • Open a Terminal within the Notebook and run: apt-get update && apt-get upgrade
  • Now, we’ll install wget on the instance by running apt-get install wget
  • Then, let’s add the Jupyter wget extension by executing pip install wget
  • Once these commands are run, it’s a good idea to stop and restart the notebook kernel.

Since all dependencies have been installed, now we should be able to download files from GDrive into our Gradient storage. To do so, we need to set our file share to Anyone on GDrive and then use the syntax below for files that are less than 32 MB :

!wget —no-check-certificate 'GOOGLE'S SHARING LINK' -O FILENAME.ext

ext= file extension

For large files , run the following command with necessary changes in FILEID and FILENAME:

!wget --load-cookies /tmp/cookies.txt "$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate '' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt