Activating script via button press on embedded Google Sheet - google-apps-script

I am trying to embed a Google Spreadsheet that has a script I'd like users to be able to activate. I don't want them to be able to edit anything on the page.
I thought I could do this by
Share sheet and set to edit permissions
Restrict editing on the one sheet I want to share (the images sit above the cells, so I thought this would prevent people from editing cells but allow them to click on the button
Publish to the web
Embed the sheet
Here is the iframe I used:
<iframe width="1250" height=1000 src="https://docs.google.com/spreadsheets/d/e/2PACX-1vRRajy1TK9Y9YQg-Df3bwTy9ktxPECq6T5gS7UfkrYpV_osxwDwRuQClC168B8-o4KsCdFl4kfMYtau/pubhtml?gid=1796260078&single=true&widget=true&headers=false"></iframe>
For context the scripts hide or show different rows. Clicking "show game 2" hides a section of rows and "show game 1" unhides these rows.
The sheet embeds okay but isn't interactable. I have turned off the restricted editing to test (it's back on) and that didn't allow people to edit anything, so I am not sure what I am doing wrong here.
Any help would be greatly appreciated! Cheers!

Workaround:
Use a another button outside the embedded spreadsheet instead.
Publish a headless web-app from your sheet using doPost()
On Button click, use JavaScript to post from your website to apps script web-app
On receiving post request, hide/show the rows using your original script.
References:
Web-app

Related

Use Google App Script to prevent user opening url link in Sheets if site is already open in another browser tab

I've got a Google Sheet that contains numerous hyperlinks.
I'd like to prevent the user from opening multiple instances of the same site.
ie. user clicks the hyperlink in one cell which opens the linked site in a new tab, then attempts to click the same hyperlink while the first new tab is still open - I'd like a dialogue box to appear saying that they cannot open this second new tab until they have closed the first one.
Is this possible via Google App Script?
Many thanks!
Unfortunately not. GAS has no access to your browser data and cannot know what tabs are open.Moreover, GAS has no way of intercepting hyperlink clicks from within a spreadsheet, it can only do that in a side bar, modal (or modeless) dialog, a custom or an add-on menu or an image with a script attached to it.

Display a editable Google Sheet on a web page

I want to display an editable Google Sheet on a web page.
No problem for that.
The problem: I want to display this sheet without the menus, columns and lines. Is it possible ?
Or display the sheet in full screen mode, but I do not know the javascript function to execute when opening the sheet.
Ex.: https://docs.google.com/spreadsheets/d/1xwheykkZMb806JKNoPGcVl17TpIm4Z9LTLJb8HAhVVk/edit?usp=sharing
How to do ?
Thank you
Go to File > Publish to the Web.
And then, you will see this kind of pop up. You can publish it and also get the link. Google Slide and Docs also have this feature. As you can see it, you can also get embed tag for inserting it in HTML. You can stop publishing with the Stop publishing button whenever you want.
And as far as I know, there is no such thing that you can edit the file with that mode.

Modify a Google Slides presentation while presenting?

I'm afraid I already know the answer, but maybe someone else has found a way to do this.
I've been perusing the Slide Apps Script reference, and I'm excited about the possibilities. One thing I would like to do is alter a slide mid-presentation. Specifically, I would like to somehow indicate a link has been clicked.
If links in a presentation turned purple like web links I would settle for that, but I would like to use a trigger when a certain link is clicked or when a certain slide is shown. This trigger could run a script that alters the slide with the link appropriately to show the link has been clicked or even remove the link altogether.
I know the Slides API is behind the others, but Forms have installable triggers that can run onFormSubmit and Spreadsheets have triggers that run onChange and onEdit. I would love to see Slides have an onPresent trigger that ran a script that could detect slide changes with methods like onSlideChange that could report currentSlide. That way we could run scripts while the presentation is showing and take action based on current slides or links.
Aside from Slide specific triggers being added to the API, is there any way to modify slides during a presentation? Or at least show that a link has been clicked?

disable dismiss hyperlink and message on google spreadsheet

When we run any method of Google App Script,a message appears on Google Spreadsheet with dismiss hyperlink.
For Example:
Running Script methodname Dismiss hyperlink
I would like to know if there is any option to disable the message and dismiss hyperlink that appears on Google Spreadsheet when any function is executed at the back ground. In not , please share what alternates are available to hide this out.
It is within a div of class docs-butterbar-container so on your own machine, you could add
.docs-butterbar-container {
display:none;
}
to a user stylesheet.
But if you are hoping to hide it from other others of your sheets/scripts then your likely out of luck, unless you have means of rolling out user stylesheets.
I also wouldn't recommend hiding this. It's useful.

How to dynamically change the spreadsheet of a Google site page?

I've checked this issue and now I know (with getHtmlContent and setHtmlContent) how to create a webapp that :
a) takes into account the active user id
b) selects accordingly the right spreadsheet to be displaid
c) adapts a Google site page with the selected spreadsheet
But my problem is that I want to dynamically adapt the page when the user clicks the link to it (from navigation area). How can I trigger my webapp ?
Thanks for the help !
I don't think it is possible to invoke scripts from links in the Navigation area. But it is definitely possible to invoke an Apps Script on a link in the content area of a Google Sites page.
You can consider invoking your script from such a link