The docs for HtmlService don\'t state that this shouldn\'t work, but it seems that the template approach is limited to web app Apps Script projects.
I am attempting
It seems you haven't gone through the documentation in detail. Please, look at the reference documentation of class HtmlTemplate.