[ad_1]
Google Colab has been around since 2017 but has gained more popularity recently from SEO professionals sharing code samples.Β
SEOs love Colab because, unlike GitHub, you 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.
In case youβre new to Python, a Jupyter Notebook is a free online tool you can use online to write code, solve math problems, make graphs and show your work. Itβs like a digital notebook that helps you keep all of your project parts in one place and share them easily with others.
The best part about Google Colab? Itβs free.
If you require more computing power, there is a tier pricing system. As of writing this, I pay $9.99 per month for the first paid tier. The next tier is $49.99 per month and then thereβs a custom enterprise version.
Benefits of Google Colab
Iβve personally reaped the benefits of Google Colab for several years and am pleased to share what Iβve found to be its biggest benefits for SEOs.Β
Fast to start
If youβve ever installed Python on your local machine, then you know firsthand how annoying it is to get Python set up. Also, if youβre trying a new bit of code, then youβre likely having to install new libraries to get your code to run.Β
The best part about Google Colab is that most common Python libraries are already installed on Google Colab. If something is missing, you can simply run:
!pip install new-library
The one nuance here is that you need the exclamation point before pip to install a new library.Β
Doesnβt use your computerβs bandwidth
I often use Python to compute large datasets, which can take quite a bit of time. Iβve run some bits of code that take hours to compute due to the size of the data.Β
In SEO, we often run crawls and other analyses in the background while we work. Have you ever run a Screaming Frog crawl that completely slows down your computer, making it nearly impossible to do other SEO tasks?
With Google Colab, you can seamlessly run compute-intensive code and work on other SEO tasks while the code runs.
Shareable
Google Colab is meant to be easily shared with collaborators or the world. As someone who believes in the power of open source, I believe that Google Colab is great for me to share code with the SEO community.
AI integration
Google has integrated Gemini directly into Google Colab. So, if youβre struggling to build a new feature in your code, you can leverage AI to help generate new code features.
I would urge caution when doing this, as you may find yourself debugging more than helping yourself.
Dig deeper: Can AI perform technical SEO analysis effectively?
Get the daily newsletter search marketers rely on.
How to use Google Colab
Letβs dive right into how to use Google Colab. Iβll run you through the eight most important features to get you right to coding for SEO.
How to run code
Probably the most simple step here is to know how to actually run the code.
Once youβre ready to run your code, click the play button.Β
How to open the folder pane
To run code that relies on any source data or exports results into a file, youβll need to be able to open the folder. Luckily, just like running code, this is just one button, specifically the one that looks like a folder.
How to connect to Google Drive
One of the great things about Google Colab is that itβs part of the Google suite of tools, allowing you to connect directly to files in Google Drive and even save your results to Google Drive.
To connect to Google Drive, you first need to mount It by clicking the button shown in the screenshot below.
Once Colab finishes mounting Google Drive, your Google Drive folder will appear in the files pane.Β
From here, youβre able to reference any of those files by right-clicking on the file, selecting a copy path and pasting it wherever you reference a file in your code.
How to upload files manually
Before uploading files, note that anything you upload will not be saved and will only be used as temporary files. Those files will disappear once you refresh the page or close it.
If you want the files to stay available, youβll need to use Google Drive and connect to them that way (see previous steps).Β
If youβre OK using files temporarily, then you have two options. You can drag and drop your files from your computer to the files pane or click the upload button.
How to create new files directly in Google Colab
Sometimes, I find it easier to create new files directly in Google Colab.
For example, if I have a bunch of keywords I want to analyze, itβs easier for me to copy them and paste them into a file in Colab rather than create a new file locally on my computer and upload it.
To do this, just right-click on a blank space in the files pane and click New File. From there, you can name it whatever you want, and paste your data and then save it with your hotkeys (Command + S or Control + S).
How to download results
Once youβve run the code, you may have an exported file created in the process.
You can preview the file by double-clicking on it, but if you want to download it, all you need to do is right-click on it and select Download.
How to connect to a runtime
If youβre running code that may take a more heavy compute load, you may want to experiment with a faster runtime.
To do this, select Runtime in the top menu and then in the dropdown, select Change runtime type.
From there, youβll see some options that you can change.Β
Please note that if youβre going to change the runtime, any files in the file pane will disappear.Β
How to use the AI integration
One of the latest features in Google Colab is the integration of Gemini. Google has made it easy to take advantage of this new feature by adding a Gemini button in the top right of the screen.
By clicking that, a sidebar will appear for you to ask it prompts.Β
Free code to get you started
Now that youβve taken the crash course to getting started with Google Colab, itβs time to try some code!Β
In one of my previous articles, Iβve provided five Python scripts for SEO that you can try right now in Google Colab.
In that article, you will be able to see the context of the scripts, how to set them up and I provide the actual code for you to try.
Itβs never been easier to get started in Python for SEO. Happy coding!
Contributing authors are invited to create content for Search Engine Land and are chosen for their expertise and contribution to the search community. Our contributors work under the oversight of the editorial staff and contributions are checked for quality and relevance to our readers. The opinions they express are their own.
[ad_2]