Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a runnable link to Colaboratory notebook

Someone share a Jupyter notebook via Google Drive. https://drive.google.com/file/d/0B88HiG_KpEbQcVhNa1NpZzVrT3c/view?usp=sharing

I want to make the link a runnable version on Google Colab instead. How do I do that?

like image 426
korakot Avatar asked Nov 04 '17 11:11

korakot


People also ask

How do I link to a Google colab notebook?

Simply click the Share button at the top right of any Colab notebook, or follow these Google Drive file sharing instructions. If you choose to share a notebook, the full contents of your notebook (text, code, output, and comments) will be shared.

How do I link Google Colab?

With Colab you have to insert an <a name="id"></a> tag in the cell you want to link to.

How do I open URL in Colab?

There is currently no way to do what you are asking for – to construct a URL that will cause Colab to automatically load the contents of a . py file at a particular URL into a new Colab notebook. The closest thing to this is to host a notebook on github, and then use a Colab url to open it: e.g.


2 Answers

First take the ID part from the Drive URL. Here the ID is 0B88HiG_KpEbQcVhNa1NpZzVrT3c

Then put it in the fileId parameter in Colab URL, like this. https://colab.research.google.com/notebook#fileId=0B88HiG_KpEbQcVhNa1NpZzVrT3c&offline=true&sandboxMode=true

Notice the offline and sandboxMode parameters. Without them, the notebook will be read-only. In that case, you need to either duplicate it or change to playground mode to make it runnable

update

Newer URL is in this format instead:

https://colab.research.google.com/drive/0B88HiG_KpEbQcVhNa1NpZzVrT3c#offline=true&sandboxMode=true

like image 100
korakot Avatar answered Nov 08 '22 17:11

korakot


Easiest method- when the notebook is open in Colab:

  1. Click the Share button in the top right.
  2. Copy the link provided at the top of the Sharing dialog.
like image 37
blois Avatar answered Nov 08 '22 15:11

blois