I have one Google Document with 20 pages.
I would like to insert some words with special reference as !#company_name#! into Google document with few different pages.
Use Below code:
var cursor = DocumentApp.getActiveDocument().getCursor();
var element = cursor.insertText('!#company_name#!');
We need one Toggle button through which I can replace with it's proper value as "Motorola Company LLC". That I achieved via below code:
Use Below code:
var sampleDoc = DocumentApp.openById(docId),
var docBody = sampleDoc.getBody();
docBody.replaceText('!#company_name#!','Motorola Company LLC');
Now, I have replaced the text from '!#company_name#!' To 'Motorola Company LLC'.
Now Question: Is there any functions available in Google App script to toggle between these 2 items? So I can easily check the key and toggle it to value and toggle it to key again and so on...
Examples other key pairs:
- !#company_name#! :: Motorola Company LLC
- !#company_data#! :: 12 December 2015
- !#company_employee#! :: 50+
P.S: The toggle button will switch between above key & pair only.