Charts have an id, but it's only settable by apps script., and in any case the Apps Script ID is not the same as the Sheets API chart id., Charts are also likely to be across multiple sheets. For comment..
This is how I plan to support inserting of charts
The global name.value sheet can be used to insert a chart
Name,value
mychart,chart
And in the template
- {{mychart}} this insert a chart that is still linked to the original data
- {{{mychart}}} this inserts a static image of a chart
The chart is defined as below..
Since the chartID is unlikely to be known, use its position in the chart list (starting at 1), with the prefix chart as below, so you can use its id, if known or its position.
To insert charts from a different sheet than the default data sheet, you can specify the sheetname.
If sheets have "." in the name, then quote them
- chart."sheet.name.with.dots".3
Charts can also be inserted from column data. Just name the column and use that as the key in the template eg .. {{datachart}}
and the contents of the column follow the same scheme as above.