How to Run All Cells In Google Colab

How to Run All Cells In Google Colab

ยท

3 min read

Table of contents

I had a presentation with a teammate a month back where we had to showcase a project in front of an audience. I couldn't use my code which was on colab mostly because it wasn't complete yet and we decided to go with my teammate's code instead since we'd worked on mostly the same thing.

A few minutes before the presentation I suggested we run all the cells except the final one before getting on stage so as not to waste time, my teammate looked at me, clicked on a few things and next thing I knew all the tabs had been run. Shock would probably be an understatement for what I felt then.

I've been using Google Colab for about 3 months now and every time I worked on a project I had to run each cell independently up until the last one, I never even imagined there was a way to run all cells at once. I realised that my teammate was using Jupiter notebook and I had decided to start using that instead of colab to save myself from such troubles in the future. (never got around to it though)

Fast forward 1 month later and it somehow just dawned on me that I might be able to do the same on colab (stupid, I know). And yes, there is indeed a way to run all your tabs at once on colab, which you'll have learned after reading this article.

Steps

  1. The first step, of course, is to open up your colab notebook on any project. Your screen should look something like this.

    plain image of a Google Collab notebook

  2. Next, navigate to 'Runtime' which is at the top of your screen right here.

    collab notebook image highlighting the 'runtime' location

  3. Click on 'Runtime' and you'll get this dropdown

    Image of the dropdown shown after clicking on 'Runtime'

  4. You can now see the various options you have, specifically the one which says 'Run all', click on it to run all tabs in the notebook or simply press the ctrl and F9 keys respectively on your keyboard.

Image specifying the location of the 'Run All' button on the dropdown

There are also a couple of other commands there that will prove helpful, like the 'Run before' which runs all the cells before your current cell or the 'Run after' which runs all the cells after it, and many more with their corresponding shortcut keys in front.

Now you don't have to waste your precious minutes running all those cells one by one like I did.

Nice, right?

Hint: Feel free to explore the other buttons just in case you find something you need, you never know.

Conclusion

In this article, you learned how to run all cells in Google Colab and discovered some other helpful buttons along the way.

I hope this article was helpful to you. Check out my other articles at Iqmacodes to get more helpful articles like this one.

โœŒ๐Ÿพ

ย