There is a google sheets implementation can we have google docs too?
Also, I think it would be good to have batchUpdate support for both, or may be replaceAllText/Template support that does something similar to below code. This way we would be able to manually create a template, then the trough a workflow, copy the file, and replace all variable with values from an object. Unfortunately, this won’t cover any looping or logic mechanism in the templates, but it would be a great start. In the future, it would be amazing if we have some templating functionality.
reqs = [{'replaceAllText': {
'containsText': {
'text': '{{%s}}' % key.upper(), # {{VARS}} are uppercase
'matchCase': True,
},
'replaceText': value,
}} for key, value in context]
# send requests to Docs API to do actual merge
DOCS.documents().batchUpdate(body={'requests': reqs},
documentId=copy_id, fields='').execute()
Code from here Mail merge | Google Docs API | Google Developers
For templating it might be possible to use NameRanges, unfortunately right now there is no GUI for this in Docs, only in Sheets.
https://developers.google.com/docs/api/reference/rest/v1/NamedRange