0

How do I assign Google Apps Script variable with javascript variable?

<script>
var myJSVariable = <?= myAppScriptVariable ?>;  //works
<? myAppScriptVariable = ?> myJSVariable <? ; ?>  // does not work

1
  • I'm not sure I understand what you want to accomplish. Do you want to pass a variable from client side to server side? Please be more specific and provide all the relevant code. Commented Jan 14, 2020 at 14:11

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.