How to reply using sidebar in app script? - google-apps-script

I have a Google app script application for gmail. From the sidebar, when I click a button, I want to be able to paste text into the current reply email where my cursor is. Based on the Google docs, there is no API for this. I am only seeing it is possible to create a completely new email draft. Anyone know how I can insert text into the current reply email by using the sidebar?

Related

Activating script via button press on embedded Google Sheet

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

adding a button to Gmail contact hover widget in the website

I don't know if this possible,
I wanted to add a button with custom action using email address to the hover widget that comes up.
I'm assuming google app script should be the right way to go. But don't know what to search in the reference guide.
Gmail add-ons can't modify the Gmail UI, they only could create Cards which are shown on side panel.
Reference
https://developers.google.com/gsuite/add-ons/gmail/

Open Gmail Add-on by default on opening mail

I am working on Gmail Add-on using Google Apps Script.
I wanted to know if there is any way in which my Add-on will be opened by default without clicking on the add-on icon? For example, if the mail contains an attachment, add-on should open without clicking the icon on the sidebar on the right.
As of now, there is no way we can achieve that and that is not possible also because if multiple add ons have similar behaviour on opening mail with attachments, which add on should open. Many race conditions come, so I guess it is not good to have such a feature.

How to show images on text hover in google docs addon

I am new to google docs Add-ons. I am working on an add-on in which I need to show set of image on text hover like tooltip in html
I did not find a way to implement this after hours of googling. please help.
This is not possible.
The above because the Documents Service of Google Apps Script doesn't include "on hover" event / trigger or something similar
The only way is by using a dialog or sidebar and they can only be launched by clicking on a custom menu or by using google.script.run on a previously opened dialog / sidebar.
References
https://developers.google.com/apps-script/guides/doc
https://developers.google.com/apps-script/guides/triggers
https://developers.google.com/apps-script/guides/dialogs
Related
Show Popup of YouTube video within Google Doc

google app script documentation clear formatting api

I would like to write a google app script to automatically clear the default text formatting of my uploaded/converted google text documents. When editing a google document in google drive, this can be done manually by selecting the text and clicking the the "Format\Clear formatting" drop-down menu item.
I am wondering if there exists such google app api or apis or any other suggestions for doing this programmatically?
Google Apps Script can't run on document upload. So you can't do this without having to install script on every document. And it takes longer than just pressing Ctrl+A and clicking the clear formatting button.