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

Updated on Friday, October 4, 2024

Comments Page 2

Return to post.

Comments

Robert Ellison

If you're getting as far as headers written to the sheet with no errors then the problem is likely the sitemap file. Check that the URL is correct, and that it's a sitemap file (not a sitemap index file).

Mohammad

Thanks for answering

I fill all fields script, only read fields sitemap! Not filled col "Verdict","ROBOTS.TXT" "State","Indexing State","Last Crawl Time","Page Fetch State","Google Canonical","User Canonical"

I do not know why?

I went exactly step by step with the training.

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

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.