how to call a script from inside a google document - google-apps-script

In a google document, is there a way to make a piece of text (or a hyperlink or a button inside the text) calling a google app script?

The options are to create a custom menu or a sidebar panel. For further details see:
https://developers.google.com/apps-script/guides/docs
https://developers.google.com/apps-script/guides/menus
https://developers.google.com/apps-script/guides/dialogs
Related questions:
Is it possible to modify the Google Docs/Sheets right-click context menu?
Add custom menu to a Google Document

Related

Add a clickable menu item or a button to the Google Docs editor [duplicate]

In a google document, is there a way to make a piece of text (or a hyperlink or a button inside the text) calling a google app script?
The options are to create a custom menu or a sidebar panel. For further details see:
https://developers.google.com/apps-script/guides/docs
https://developers.google.com/apps-script/guides/menus
https://developers.google.com/apps-script/guides/dialogs
Related questions:
Is it possible to modify the Google Docs/Sheets right-click context menu?
Add custom menu to a Google Document

Is it possible to create a 'button' on Google Docs user interface using google apps script?

Is it possible add a custom button like 'submit for review' into google docs UI, while integrating google docs into our use case?
I see apps script allows us to create custom menus:
https://developers.google.com/apps-script/guides/menus
What I'd essentially want to do is, add a button similar to or replace the share button in google docs Ui with our own custom button.

How to add a custom menu for google drive

As a part of project requirement I need to add a custom menu (context menu) to the google drive right click options.
As per my research google app script can help for creating a custom menu for google docs, google form and google sheet. However I haven't yet come across a way to add a custom menus for google drive.
I cannot use chrome extension as I need it to be all browser compatible.
Any ideas if it's even supported and possible.
Any help is appreciated!
Eventually I had to integrate an app with "Open With" option in Google Drive.
Apparently, context menus are not supported in Google Drive.
You cannot add custom context menus in Google Drive. The custom menus you read about in Docs, Sheets, etc are added in the menubar at the top of the editor, not into the right-click menu.

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.