Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collapsing Elements in a Google Doc With Google Apps Script - Is This Possible?

I'd love to be able to collapse and expand sections in my Google Docs document, making large documents easier to navigate. I was wondering if this is possible with Google Apps Script, or if I'd be wasting my time trying to find a way.

like image 441
Squis Avatar asked Jun 12 '14 17:06

Squis


People also ask

How do I collapse text in Google Sheets?

Right-click any of the plus or minus signs for a group. Then, select “Expand All Row/Column Groups” or “Collapse All Row/Column Groups.” This lets you expand or collapse all of your row or column groups in one fell swoop.


1 Answers

You cannot do anything special in Apps Script, just automate stuff that you can do manually.

So, there's no way to do real collapsing, since there's no such feature in Google Docs. But you can use available functionality in unorthodox ways and make it work for you. For example, you could save the content somewhere else (maybe another document), so you can remove and add "sections" making it look like collapsing. This would have the downside of polluting the document revision history a lot, since every collapse event will be treated as changes to the document. Or you could export the document as HTML, maybe host it on Drive itself and implement the collapsing there, using javascript, then just serve the link to the user.

Anyway, this is just a couple of ideas that recklessly throwing here, which may or may not work for you. But none of will ever be real collapsing on a Google Doc.

like image 66
Henrique G. Abreu Avatar answered Oct 04 '22 07:10

Henrique G. Abreu