Google Colab has been around since 2017, but has recently become popular with SEO experts sharing code samples.
SEOs love Colab because, unlike GitHub, they can actually run the code directly on the platform.
What is Google Colab?
Google Colab is a tool that allows users to quickly run Python directly on the platform with little to no setup. Google Colab is a hosted Jupyter Notebook that uses Google's hosting services in the cloud.
If you're new to Python, Jupyter Notebook is a free online tool that allows you to write code, solve math problems, create graphs, and demonstrate your work online. It's like a digital notebook where you can keep all the pieces of your project in one place and easily share them with others.
The best thing about Google Colab is that it's free.
If you need more computing power, there is a tiered pricing system: at the time of writing, you're paying $9.99 per month for the first paid tier, the next tier is $49.99 per month, and then there's the custom enterprise version.
Benefits of Google Colab
I’ve personally enjoyed the benefits of Google Colab for several years now, and am excited to share here what I’ve found to be its biggest benefits for SEO.
Fast startup
If you've ever installed Python on your local machine, you know firsthand how tedious it can be to set it up, and when you try out new code, there's a good chance that you'll need to install new libraries in order for the code to run.
The best thing about Google Colab is that most of the common Python libraries are already installed in Google Colab, if you are missing something, just run the following command:
!pip install new libraries
One nuance here is that you need an exclamation mark before pip to install new libraries.
Does not consume bandwidth on your computer
I often use Python to make calculations on large data sets, which can take a significant amount of time. I've run some code that took hours to calculate due to the size of the data.
SEOs often run crawls and other analyses in the background while you work. Have you ever run a Screaming Frog crawl that completely slowed down your computer, leaving you barely able to perform any other SEO tasks?
Google Colab allows you to run computationally intensive code seamlessly and work on other SEO tasks while the code is running.
Shareable
Google Colab is designed to make it easy to share with your collaborators and the world, and as believers in the power of open source, we think Google Colab is the perfect place to share code with the SEO community.
AI Integration
Google has integrated Gemini directly into Google Colab, so if you're struggling to add new functionality to your code, you can leverage AI to generate new code features for you.
I would advise caution when doing this as you might end up doing more debugging than helping yourself.
Learn more: Can AI perform technical SEO analysis effectively?
Get the daily newsletter search marketers trust.
How to use Google Colab
Let’s dive right in and see how to use Google Colab. We’ll cover the 8 most important features to help you get started coding for SEO right away.
How to run the code
Probably the easiest step here is to know how to actually run the code.
When you're ready to run your code, click the play button.
How to Open the Folder Pane
You need to open a folder to run code that depends on the source data, export the results to a file, etc. Luckily, there is just one button that looks like a folder, just like Run Code.
How to connect to Google Drive
One great thing about Google Colab is that, because it's part of the Google suite of tools, you can connect directly to files in Google Drive and save the results back to Google Drive.
To connect to your Google Drive, you first need to mount it by clicking the button shown in the screenshot below.
Once Colab finishes mounting your Google Drive, you will see the Google Drive folder in the files pane.
From here, you can reference any of these files by right-clicking on the file, selecting copy path, and pasting it where you want to reference the file in your code.
How to manually upload files
Before you upload a file, please note that anything you upload is not saved and is only used as a temporary file. These files will disappear when you refresh or close the page.
If you want the files to remain available, you'll need to use Google Drive and connect to them that way (see previous step).
If you're okay with using the file temporarily, you have two options: you can drag and drop the file from your computer into the files pane, or click the Upload button.
How to create a new file directly in Google Colab
In some cases, you may find it easier to create a new file directly in Google Colab.
For example, if you have a lot of keywords you want to analyze, it's easier to copy and paste the keywords into a file in Colab than to create a new file on your local computer and upload it.
To do this, right-click on an empty space in the file pane and select New FileFrom there, you can paste the data with any name you like and save it using the hotkeys (Command + S or Control + S).
How to download your results
When you run your code, the process may create exported files.
You can preview the file by double-clicking it, but if you want to download it, just right-click on it and select Download. download.
How to connect to the runtime
If you are running code that may be more computationally intensive, you may want to try a faster runtime.
To do this, runtime From the drop down menu at the top Change the runtime type.
From there, you'll be presented with a few options you can change.
Note that when you change the runtime, all files in the files pane disappear.
How to use AI integration
One of the newest features of Google Colab is Gemini integration, and Google has made it easy to use this new feature by adding a Gemini button on the top right of the screen.
Clicking on it will bring up a sidebar asking you a prompt.
Free code to get you started
Now that you've had a crash course on getting started with Google Colab, it's time to try out some code.
In one of my previous articles, I shared 5 Python scripts for SEO that you can try out right now on Google Colab.
This article provides the context of scripting, how to set it up, and some code to give you a try.
Getting started with Python for SEO has never been easier. Happy coding!
Contributors are invited to create content for Search Engine Land and are selected based on their expertise and contributions to the search community. Contributors work under the supervision of editorial staff, and contributions are checked for quality and relevance to our readers. Opinions expressed by contributors are their own.