API Integration
Here’s how to access the Google Search Console API, what you’ll need, and why it’s useful. To start, I’m sending you to another site: https://console.cloud.google.com/. This is where we’ll create a dedicated project and enable the relevant API for Google Sheets. Naturally, you’ll need a Google account to sign in.
Next, you’ll need to create a “project.” You can do this by pressing Ctrl+O or by following the steps shown in the image:

Please don't forget to navigate to the previously created project by clicking on its name. After that, you will need to enable the required API from the library: the Google Search Console API.

Let's find the required API using the search function—type "search console." You will see a single option; click on it and activate it:

After clicking, you will be redirected to the management page for this API. All that remains is to create the appropriate access keys and download them. To do this, click the “+ Create credentials” button and select “Service Account”.

You will be redirected to a new page, where you will need to name this standalone account and grant the appropriate permissions to edit the spreadsheets.

There’s just a little bit left. Generate the key and download it.

Once you have the key, you also need to grant access to Google Search Console for the service email address. Copy the address and go to the site settings in Google Search Console.



Now, any Python script with access to the previously downloaded credentials file will have access to your Google Search Console account.
Using the API in the script
To do this, install the following packages in your virtual environment:
Next, to demonstrate how to connect to the API, I will show an example function:
In other words, the file containing the required details is first loaded into memory, followed by a request with the necessary parameters to retrieve the required data. Full documentation from Google on what to send and how to interact with GSC can be found on this page.