0

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...]

Bugaboo
  • 973
  • 1
  • 17
  • 36
  • I have to apologize for my poor English skill. Unfortunately, I cannot understand your current issue. So, can I ask you about the detail of your question? 1. Can I ask you about the detail of the current issue of your script? 2. Can I ask you about the detail of `conditionally append`? 3. Can you provide your current script? 4. About `Subsequent calls to AddOrAppendToList("item 2") should append to the existing list, i.e.`, in this case, I think that it is required to suppose that a list is only one in the Google Document. How about this? – Tanaike Feb 27 '23 at 04:34
  • @Tanaike: I want to get a handle on the existing list ID and be able to append to it, or worst case, make a copt of existing list, delete it and add a new list with the old content and the new item. I see greater control with with Google App Script route (eg: https://stackoverflow.com/questions/29032656/google-app-script-merge-multiple-documents-remove-all-line-breaks-and-sent-as) that allows getting a handle on a listID but I don't see an equivalent to get these handles using the REST API – Bugaboo Feb 27 '23 at 17:56
  • Thank you for replying. I would like to support you. But, I have to apologize for my poor English skill, again. Unfortunately, from your reply, I cannot still understand your question. But I would like to try to understand it. When I could correctly understand it, I would like to think of a solution. I would be grateful if you can forgive my poor English skill. – Tanaike Feb 28 '23 at 00:25

0 Answers0