6
votes

In Google CoLab on the left is a pane that can be opened that shows Table of Contents, Code snippets, and Files. In the Files pane there is an upload button, I can upload a notebook file to this Files area. But once the notebook file is uploaded, there is no option to run it as a notebook. The menu option File->OpenNotebook doesn't show the CoLab /content/ files as an option to start a notebook. Is there a way to do this? Or can it be added in future releases?

The reason for this request is I'd like to git-clone a repo with multiple notebook files into the /content (or Files) area of CoLab. And then be able to easily switch between the notebooks, much like the native Jupyter notebook interface that shows a directory with potentially multiple notebooks that can be started.

I've tried right-clicking on the notebook file in Files but there is no option to start the notebook. I've tried using File->Open_notebook... the Files files aren't shown as an option in any of the tabs.

The desired results is that I can start .ipynb files (i.e. Jupyter notebooks) directly from the 'Files' or /content/ section of Google CoLab.

2

2 Answers

2
votes

You can run other notebooks in your current notebook like this:

# if the file was on the google drive
%run /content/gdrive/My\ Drive/Colab\ Notebooks/DenseVideoArchitecture.ipynb

# simply replace the path in your case
%run /content/DenseVideoArchitecture.ipynb

But what you are asking is to switch between different notebooks in the same environment which might not be possible in collab.

0
votes

I couldn't understand what you actually need, but I hope below code help you:

from google.colab import drive
drive.mount('/content/gdrive')

!cd content/gdrive/My Drive/Colab Notebooks

You should mount your google drive and now you have access to drive as a local drive. In this code, at first two lines, I mount gdrive and then I redirect to some place in google drive for example "Colab Notebooks" and you can run everything you want.