skip to Main Content

I need to get information that is in a cell (F3), and insert it into a JS variable.

I know that to send variables from JS to AppScript it is through google.run.nomedafuncao()

However, in this case, the meaning would be the opposite. Can anyone help me?

In my example I have a variable called information = ss.getRange(6,3).getValue();

I want to get the data from the AppScript variable ‘information’, and pass it to the JS variable called ‘name’

I tried to send the information via JS, but without success.

2

Answers


  1. To pass a variable from App Script to the client use

    let name = null;    
    google.script.run.withSuccessHandler( function(value) { name = value; } ).nomedafuncao();
    

    Where value is returned from the server function nomedafuncao().

    Login or Signup to reply.
  2. To get an Apps Script variable and send it to JavaScript, you can use the google.script.run API, which allows you to communicate between your Google Apps Script code and the client-side JavaScript code (HTML/JavaScript).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search