Google Apps Script to force open the document outline - google-apps-script

I'm sending a google doc (view only) out to a bunch of students. I would like the document outline to show by default. I know they can manually go in to the View menu and open the document outline, but is there any way to force open the document outline when students access the document (apps script?)

Related

Google Sheets script : Click on menu item

I'd like to have a script that simply clicks on File > Download > PDF of a Google Sheets menu.
To simplify, I first tried to have the script click on "File".
With devtools I could determine that this menu item has id="docs-file-menu" so my function should look like :
document.getElementById('docs-file-menu').click();
But it doesn't work because document is not defined.
While searching for a solution, I understood that Apps scripts cannot interact with the browser, but I'm not quite sure whether that includes the sheets menus items as well?
Is there any way to make a script click on a menu item?
If not possible, is there any other way to make the "download as pdf" window appear?

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.

Manipulating a Google Doc outline using Google App Script

Is there a way to use a Google App Script to remove an item in the document outline (the outline that appears when you select View->Show Document Outline in the top menu)? I have a script that adds several H3 headers, and I don't want those headers to appear in my outline.

how to call a script from inside a google document

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

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.