Apps Script Gadget not working on a custom website - google-apps-script

i have this problem, and it seems that i'm not alone.
If i embed a simple apps script form with some textarea,buttons and labels in a custom web url www.mydomain.com/mypage...the page simply don't show nothing and the Chrome console report that error:
Refused to display document because display forbidden by X-Frame-Options.
Instead if i see the page from the original url:
https://sites.google.com/a/mydomain.com/mysite/mypage
i see the apps script correctly.
Anyone solved that problem or can tell me a workaround??
Thank you

This is a known issue and there has been a lot of chatter on this topic. Here is the issue filed in issue tracker. You may star it. People have listed some workaround as well.
Google Apps Script Gadget not working with custom web address mapping

Related

Set a custom favicon for different google spreadsheets

I use a lot of different google spreadsheets for day to day tasks.
Sometimes all of them are open at once, and combined with other websites needed it's a lot of open tabs, so the tab header is only the sheets favicon.
I'm looking for a way to add a custom favicon to each spreadsheet using Google Apps Script, to make it easier to identify them when only the icon is visible.
I've found a Chrome extension (https://chrome.google.com/webstore/detail/favicon-changer/ijaabbaphikljkkcbgpbaljfjpflpeoo) which changes the favicon to a specific file I choose, but I need a way to do it natively to each spreadsheet so that it works on any computer.
There's also a different extension which also changes the favicon, but to a random one you can't choose (https://chrome.google.com/webstore/detail/favidenticon-for-google-d/alkonpgilhahbbhihdjnamkmckfajmjo).
Since theres a way to code it in an extension, I'm wondering if there's a way to code it directly in Google Apps Script, assigning a specific file as the favicon.
I've fonund also that there's a setFaviconUrl(iconUrl) method in Class HtmlOutput, but I think it's for Web Apps, I've tried using it but haven't managed to make it work:
https://developers.google.com/apps-script/reference/html/html-output#setfaviconurliconurl
I have the icon files uploaded to a website in case that's needed (this is one of them https://www.botix.com.ar/imagenes-empresa/favicon-pedidos.ico)
I know little about code, so any help would be appreciated!
I am afraid that it is not possible at this moment. The extension you mentioned probably does not work with Google Apps Script and it may be modifying or working with Chrome specific settings or tools.
Since Google Apps Script is not able to work with Chrome related tools or APIs it would not be possible to use Google Apps Script to accomplish this. That is why the only options available are related to Chrome extensions or for web apps as you mentioned.
You can submit this as a feature request for Google Apps Script using this link

Embedding web app in Google Sites doesn't work

I have Google Apps Script deployed as "web app" linked to a spreadsheet google.
It displays a form and once you submit the form, it will process the data and put it in the spreadsheet, here the code :
https://docs.google.com/spreadsheets/d/1EBo5DooJQtcFX5GORmtOB1ri2kkMPXX6nEMvNRsobOg/edit?usp=sharing
When I access the script directly via the link below there's no problem, it's working fine :
https://script.google.com/macros/s/AKfycbyMu10ibB8dBLZj6hS_gfNSiaW4XxEnFuzVOvNHdQKcoX092Ayy/exec
But when I want to embedded like "web app" in google site like this, it doesn't work :
Do you have any idea why it doesn't work?
EDIT :
It's odd but when I tried to make a mock website (with the new version of Google site) to show you the problem, it's working :
https://sites.google.com/ggbearings.com/test/home
But it's not working on classic Google site, I guess I have to contact them to seek out an answer.

Apps Scripts within Google Sites

So I might be doing this entirely wrong, but I am trying to create a slideshow based on images stored in a google drive folder that can be easily added (ie by a non-technical person) to a google site.
I created a script that outputs the slideshow using the HTMLService. You can view the working site at https://script.google.com/a/macros/needham.k12.ma.us/s/AKfycbyOyqTr_sEMWRVBn0e0r4NV5083_LwzZSMYwPU-25_xd2m6ZexS/exec?width=300&height=200&folderID=0B-6QUsY0bQG5ZmI4QTl4T1ZQZmc
When I try to insert this script into a google site using the Apps Script Gadget (Screenshot 1) using the link above it appears that the parameters are either lost or ignored (Screenshot 2). When I hard code the parameters into the script, the slideshow loads correctly (Screenshot 3).
Screenshot 1
Screenshot 2
Screenshot 3
You cannot add the parameters to the URL when inserting your script in a Google Site. However, you can pass the parameters to the Site URL utself and the script will pick it up.
For example,
http://sites.google.com/example.com/example-site/example-page?folderID=1235
As for the width and the height, you can adjust them when you insert the script into a Site using controls that Google Sites provides
Same happened to me. My solution was to write a google gadget that iframed my apps script and added fhe necesary parameters.

Google Apps Script Web App on my Domain

I had built a Google UI Apps Script in my Drive account. It works great.
I would like to embed it on my domain. I know that I can embed it as a gadget on a Google site, but I don't want Google's URL appearing in my website.
I have a word-press site and I would like to embed this UI script into a page/post on my word-press site or create a stand alone page on my domain with this script on it.
Is this possible?
I just don't want my users to be redirected off my site and see the long ugly domain of https://script.google.com/a/macros/*************
Any suggestions?
This isn't currently supported.
See (duplicate) Embedding Google Apps Script WebApp in WordPress Page.
Visit Issue 852 and star it for updates. (There are also some potential work-arounds described in the issue comments.)

Is there an example of how to add Replace to Google Docs

Is there an example anywhere of how to use the Document apps-script API to add a button to the Google Docs menu, when it is clicked bring up a web page from my web app that prompts the user for 2 strings, then on OK it does a search & replace on the open document?
I don't need to add search/replace per-se. I just figure this is the simplest example of writing an Add-In to Google Docs that edits the open document.
thanks - dave
As it stands, this is not possible. I think this issue (which you might like to star so that you can receive updates in the thread) best describes it. Summary in post #7:
This feature request is to add the same script functionality to a
document as there is in a spreadsheet. ie menu items etc.
A recent video by google (see their blogs) hints that this will be soon available.
In the meantime u can ask for the document url from your published script interface.
If you make a googledrive.com client app you can even use the new goglepicker to select the doc.