Page 1 of 1

Steps to extract information from the project API with App Scripts

Posted: Mon Dec 23, 2024 10:12 am
by Irfanabdulla1111
Once we have seen and identified that we need to use Google App Scripts to extract information from a JSON, we need to find out what data we need to extract.

To do this, we need to access the SEMrush Project API documentation and identify the data we want to extract.

In my case, it was one element and a subset of elements, tracking the evolution of keywords and the evolution of the SEO audit.


SEMrush API Page
Creating the main menu to update information with buttons in spreadsheets
The first thing we need to do is create the buttons for Spreadsheets. To do this, we are going to

Tools -> Script Editor and paste the following code replacing the current code:


Creating menus in spreadsheets
NOTE
For those who do not know programming, everything that is inserted after the double slash (//) on the same line is not executed as code, they are comments so that it is easier for people to understand the code.

This code will cause our sheet to be updated with a new menu entry called “Update” and within it, two submenu items called “Siteaudit” and “Keywords”.

Function to extract information from Siteaudit
Once the previous step is completed, we must extract the siteaudit by making a call to the following URL:


Remember that:

Idproject : is the project identifier.

KEY – This is the API key for our SEMrush account.

Next, we create a page in spreadsheets called Siteaudit or whatever we want, but we have to be aware that email list providers in germany the name must be the same as the one we will enter in this line of code:


We go back to Apps Scripts and below the created function, we insert this code (in the comments implemented with double slash “//”, I explain each part of the code):


SEMrush siteaudit api from apps script