Monitor page index status with Google Sheets, Apps Script and the Google Search Console API

Updated on Friday, February 9, 2024

Comments Page 2

Return to post.

Comments

Robert Ellison

Try external and put something in all the required fields. Let me know if that doesn't work for you.

Mohammad

hello

step 5.Click Configure Consent Screen and choose the internal type. User type enable external type! why disable "internal type"?

please help me

thanks

Robert Ellison

The error suggests that the refresh token isn't available. Clearing script properties and reauthorizing usually fixes any issue like this. The only other possibility I can think of right now is that the script is being run by a different user than the one that authorized it - is this possible in your case (multiple Google accounts)? The property store used to save the refresh token is user specific.

bucheron

No, it still doesn't sticks, tried many times. I must say I don't know where to go from there.

Robert Ellison

I don't have that issue but I have seen Apps Script get into a bad state. Try this, go to your Google Account, Security and find the Apps with access to your account section. The script will be in there with search console access. Click Remove Access. Then in the spreadsheet choose Reset Settings from the Search Console menu. Then run Authorize... from the same menu and authorize again. Then see if the authorization sticks.

bucheron

I played a lot with the script and it itself is working fine, but the GSC authorisation seems to worn off really quickly, like 2 hours.

Script works fine, then 2 hours later back to "Error processing url Error: Access not granted or expired." and I have to authorize again.

Have you encountered the same issue ?

Robert Ellison

Change getDay() to getHours() on line 35 and schedule the script to run every hour instead of every day. This will run across hours 0-6. Optionally change line 111 to 24 instead of 7 (to spread out checks throughout the day). If you do this you need to change the spreadsheet column checkday to have 0-23 values instead of 0-6 (or just delete all rows and allow the script to regenerate. Hope that helps.

bucheron

@robert and let's say I have a small website with a small sitemap. What lines do I need to change in the code to check instantly and not wait specific days ? thank you

Robert Ellison

Hi Bucheron, the 'Added from sitemap' status is the default when a URL is first loaded into the sheet. This will change to a real status once the index status API has been called for that URL.

bucheron

Hi Robert

Thank you very much for this script, it's fine work.

Would you know be any chance why I get many urls with just "Added from sitemap" as data ? No verdict, no indexing state.

Thank you

Add Comment

All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.