Reputation: 13
How do I assign Google Apps Script variable with javascript variable?
<script>
var myJSVariable = <?= myAppScriptVariable ?>; //works
<? myAppScriptVariable = ?> myJSVariable <? ; ?> // does not work
Upvotes: 0
Views: 94
Reputation: 3847
HTML template is not supposed to pass any value to Apps Script Variable. As the doc states:
Remember, however, that because template code executes before the page is served to the user, these techniques can only feed initial content to a page. To access Apps Script data from a page interactively, use the
google.script.run
API instead.
Upvotes: 2