0

So I have written a few add-ons for a template doc that gets used to make official ones that are sent out to whoever filled "the form" in.

I cannot use View-only, because my add-ons won't run, I can't publish, because the files are private and only inside my domain.

I need them to be in edit, but not able to edit and I know it's not possible. On the other hand, my idea is as follows:

Can you, with a script, "store" all the text inside the doc and when something is edited, Re-write back over it with the stored data and use .getUi and an alert telling them editing is prohibited.

I know how I'd do certain sections of my idea, but not storing text and locations of it. No idea how to approach it, if even possible.

How would one "store" the existing text in a google doc and rewrite it back in over an edit. If it helps, the text is all in a table.

Cheers, Tea

RichTea
  • 115
  • 9
  • Questions asking us to recommend or find a **book, tool, software library, tutorial or other off-site resource** are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, [describe the problem](https://meta.stackoverflow.com/questions/254393) and what has been done so far to solve it. (Note: This is one of the canned closing reasons for off-topic questions) – Rubén Sep 27 '18 at 14:26
  • I do believe I described the problem, just not directly, "Can you, with a script, "store" all the text inside the doc and when something is edited, Re-write back over it with the stored data and use .getUi and an alert telling them editing is prohibited." I can re-word it, but i'd still be asking the same thing. The point is I don't know where to begin solving it. I'm trying to figure a workaround to not being able to "lock/protect" existing text in google docs from editing. – RichTea Sep 27 '18 at 14:30
  • If you already made any search/research effort please describe them briefly. Usually questions including a [mcve] are better received. You could share your attempts to write a function to store text, write an alert, to use an event on Google Docs, etc. – Rubén Sep 27 '18 at 14:35
  • Okay, I have a few things I can add, Cheers dude – RichTea Sep 27 '18 at 14:36
  • By the way Google Documents does't have a onEdit event but you could use the polling technique described on [How to poll a Google Doc from an add-on](https://stackoverflow.com/q/24773177/1595451) – Rubén Sep 27 '18 at 14:38
  • The no onEdit was devastating to the code I was about to add lol, I have stored all the variables from the sheet and use them to fill in the template by replacing ##REPLACEME## for example. It would be pointless to add it now, that sidebar thing looks interesting, gonna have an in depth read of it now. – RichTea Sep 27 '18 at 14:44

0 Answers0