Hey everyone! I’m trying to add a Google Apps Script project to my Google Site, but I’m hitting a wall. I’ve gone through all the steps:
Made a script in Google Drive
Added a doGet(e) function
Published it as a web app
Got the script URL
But when I try to add it to my Google Site using Insert > Apps Script Gadget, I get an error saying ‘This url is not recognised as a valid Apps Script’. What am I doing wrong?
Also, I’m curious:
Can I run a Google Drive Script without pasting code directly into the site?
Is it possible to use one script across multiple Google Site pages with different parameters?
I encountered similar issues when integrating Apps Script with Google Sites. One solution that worked for me was using the HTML embed option instead of the Apps Script Gadget. After publishing your script as a web app, copy the web app URL and use it in an HTML iframe on your Google Site.
Regarding running scripts across multiple pages, I’ve found creating a library to be an effective approach. This allows you to centralize your code and use it on different pages with varying parameters.
A word of caution: always ensure your script’s sharing settings are set to ‘Anyone, even anonymous’ to avoid permission problems. Also, remember to update and redeploy your script after any changes for the updates to take effect on your site.
I’ve been through this process a few times, and it can be tricky. Here’s what worked for me:
Instead of using the Apps Script Gadget, try embedding your script as an iframe. After publishing your script as a web app, use the ‘Deploy as web app’ URL in an iframe HTML element on your Google Site.
For running scripts across multiple pages, I’ve found it helpful to create a library. This way, you can share functions across different scripts and pages while keeping your code organized.
One gotcha to watch out for: make sure your script’s sharing settings allow access to anyone, even anonymous users. Otherwise, you might run into permissions issues.
Lastly, don’t forget to update your script’s version and redeploy after making changes. It’s an easy step to overlook, but crucial for seeing your updates live on the site.
hey mate, i feel ur pain. had same issue before. try this: instead of gadget, use HTML embed. grab ur web app URL n chuck it in an iframe. works like a charm.
for multi-page stuff, make a library. keeps things tidy. oh, n don’t forget to set sharing to ‘anyone’ or it’ll throw a fit.