The url is not recognized as a valid Google Script

2019-06-05 08:49发布

I published an App Script as a web app and everything runs fine when I use the web app URL.

https://script.google.com/a/macros/[mydomain]/s/[servicekey]/exec

When I go into a Google Site and try to insert a "Google Script Gadget" and select the URL of my web app I keep getting a message that says "The URL is not recognized as a valid Google Script". However, if I copy and past the URL in a new browser window the web app comes up just fine. Is it not possible to insert a published web app into a Google site?

I even tried using the old naming convention as described here but no luck.

2条回答
乱世女痞
2楼-- · 2019-06-05 09:42

What is the original 'container' of your script ? did you develop it from a spreadsheet ? as a standalone script file ? or in you site script editor ? The resulting webapp urls are different when hosted in a site , here is an example that can be inserted :

`https://sites.google.com/macros/exec?service=keyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

note that if a script is hosted in the site this url is not useful since the script is available directly by its name. I must admit that the interface is not really clear about that, nor is the documentation but that's the conclusion I came to, please don't consider this as an absolute truth ;-) maybe someone from Google could confirm (or not).

EDIT : the 'old notation' that you mention is still working for me for a script developed as a standalone script file using the key associated to the url structure shown above... I just copied/pasted the key without anything else where the keyxxx... stands.

查看更多
孤傲高冷的网名
3楼-- · 2019-06-05 09:47

Confirming that the URL format below works when inserted as a Apps Script Gadget URL in Google Sites.

https://sites.google.com/macros/exec?service=keyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
查看更多
登录 后发表回答