Rijul Ganguly
Rijul Ganguly

Reputation: 125

Downloading a public file from Google Cloud to Google colaboratory

I have a dataset which is publicly hosted on google cloud at this link. I would like to use this data in a Google colaboratory notebook by downloading it there. However all the tutorials I have seen which involve transferring a file from the Cloud to Colab require a Project ID, which I don't have since this is not my project. Wget also doesn't work with this file. Is there a way to download the files at that link directly to a colab notebook?

Upvotes: 1

Views: 1092

Answers (1)

korakot
korakot

Reputation: 40818

Be careful, your files are very big. It can easily fill up all Colab space.

First you need to login (authenticate yourself).

from google.colab import auth
auth.authenticate_user()

Then, you can use gsutil to list the files.

!gsutil ls gs://ravens-matrices/analogies/

And to copy 1 or more files, to the current directory.

!gsutil cp gs://ravens-matrices/analogies/extrapolation.tar.gz .

Here's a working notebook

Upvotes: 3

Related Questions