TLDR; You can track kgmids from Google’s Knowledge Graph with a handy Google Sheets script, allowing you to see the changes in the entities every day.
Google’s Knowledge Graph has ever-changing entities, and it recently underwent a massive change, deleting a whole load of entities from its database.
If your entity has a newer /g/ prefix rather than an older /m/ prefix, then there’s a high chance it could be deleted at some point.
It can be really time consuming if you’ve got a lot of entities to track to keep checking them manually each day using Knowledge Graph tools.
With a massive thanks to Gus Pelogia – I altered the code from his extremely handy Knowledge Panel tracking sheet to instead track kgmids rather than entities.
This allows me to see if those entities have changed over time, as it updates daily.

You can see in the image above that I was tracking my own personal entity, which then disappeared from Google’s Knowledge Graph on 22nd February 2025 and has not come back again, as it has actually been deleted, despite the panel being claimed nearly a year ago.
Having a tracking sheet like this is really handy to spot changes as they happen. Yes, you still need to check the sheet each day, but you can quickly spot any issues and try to rectify them.
The script below tracks the following information in Google’s Knowledge Graph:
- Date – this is the date for the result
- Query – this is the keyword or entity you want to track
- URL – this is the URL of the kgmid that you’re tracking
- Name – this is the name of the entity in Google’s Knowledge Graph, which can change over time
- Type – this is the type of entity Google has assigned to the keyword, which can change over time
- Description – this is the short description – normally the type of company or entity e.g. Fast Food Restaurant
- Detailed Description – this is the long description
- Where Description Is From – this is where the description is pulling from
- Website (URL) – this is the “entity home” or a website that Google associates with the entity
- Image Content URL – this is a URL of an image which appears in the Knowledge Panel, so that you can see where it’s coming from
- Image URL – if there are any additional images, this is where they are pulling from

How To Set Up Your Kgmid Tracking Sheet
The first thing you need to do is head over to Google’s API to get yourself an API key.
Go to this website – https://console.cloud.google.com/welcome and click on the APIs and Services button then click the Enable APIs and Services link.
Search for “Knowledge Graph Search API” and click the button for it when it comes up.
Click the blue Enable button.
Now click on the Credentials tab, and then + Create Credentials > API Key
A popup window will appear with the API key so make sure you copy this into a safe place for now. This is a secret key, so don’t share it with anyone.
Now, before you continue, click the 3 dots to the right hand side and Edit API Key.

Go to the API Restrictions, click Restrict key, then click the dropdown and choose Knowledge Graph API and click the blue Save button.

Once you have your API key, you can create your own spreadsheet with Google Sheets.
Click on Extensions > Apps Script to create your script which will power the sheet:

Delete the function that’s already there:

Testing The Script
You need to paste your API key into the second line of the code, where it says “PUT-YOUR-API-KEY-HERE”.
Next, head over to your spreadsheet again, and enter the following headings:
- Column A – Date
- Column B – Query
- Column C – URL
- Column D – Name
- Column E – Type
- Column F – Description
- Column G – Detailed Description
- Column H – Where Description Is From
- Column I – Website Image
- Column J – Content URL
- Column K – Image URL
- Column Q – Query
There is an intentional gap between Column K and Column Q.
Now it’s time to test that your script is working.
Head back over to the Apps Script tab.
Rename your project to something meaningful:

Now click on the little save button:

Next go back to your spreadsheet tab and add a kgmid that you want to track in column Q like this:

Head back over to your Apps Script tab and then click the Run button:

Now Google will ask you to set the permissions for the sheet, so firstly, click the Advanced link, then click on the “Go to kgmid tracking sheet (unsafe” link:

Now it will ask you to sign into your Google account:

Then click the “Review Permissions” button:

Then it will ask you to verify permissions. Make sure you tick all of them:

Finally, it will go back to the main Apps Script screen again and it will run itself. It should say “Execution Started”, then “Execution Finished” a few seconds later:

Go back to your spreadsheet and check that everything has worked as expected. If any of the columns have N/A that means that there’s no information in Google’s Knowledge Graph for that particular piece of information.


Automating The Script
You can set this up to run at a certain time each day by using a Trigger.
Your computer doesn’t need to be on for this to work, it will run automatically at the time you set each day and populate the sheet.
If you want to track a lot of kgmid’s at once then I recommend that you split them between different sheets so that your Google sheet doesn’t get too long over time.
Go to Apps Script, and click on Triggers on the left hand side menu there, which looks like an alarm clock.
Click the blue Add Trigger button on the bottom right hand side of the screen.
Now change your fields to match the image below:

You can set the time of day to whenever you want.
Click Save.
If you want to track any more kgmid’s then add them to your sheet in column Q under the one that’s already there.
Check back tomorrow to make sure your script has executed successfully!

Written by Kelly Sheppard
Kelly Sheppard is a search engine optimisation professional, author of the book “The Structured Data Guide for Beginners” and the founder of The Structured Data Company.