Var offset = body.getChildIndex(cursor.getElement()) īody.insertParagraph(++offset, 'Some Header\n') īody.insertListItem(++offset, color + ': ').setGlyphType() īody.insertParagraph(-offset + colors.length, 'sample text') // Please set the text here.ĭocumentApp.getUi().alert('Cannot find a cursor in the document.') Here is what I have: function onOpen() ĭateStr = today.toLocaleDateString('en-US', options) + '\n\n'
I'm a bit stuck on how to add text and list items at the same time. I'm trying to create a simple script that prefills a template into a Google doc at the cursor point.