I'm creating an AddOrAppendToList
functionality that can conditionally append to a list (if one does not exist already) in a GDoc. For eg: on an empty doc, invoking AddOrAppendToList("item 1")
should create a new list on the doc, i.e.
- item 1
Subsequent calls to AddOrAppendToList("item 2")
should append to the existing list, i.e.
- item 1
- item 2
Neither insertText
and createParagraphBullets
request parameters allow conditional appending. Note that the doc itself may have manually curated text after the list that's exclusively curated via the API. For eg, the doc could be in the state of:
- item 1
- item 2
[...manually entered paragraphs...]
and calling AddOrAppendToList("item 3")
should result in:
- item 1
- item 2
- item 3
[...manually entered paragraphs...]