google apps script - Simple IF statement wont work -


i wrote simple function should return value in a1 cell if in a1 of other sheet cell. im not sure wrong here. not have errors still wont job.

function check() { var ss = spreadsheetapp.getactivespreadsheet(); var sh1 = ss.getsheetbyname("downloader"); var sh2 = ss.getsheetbyname("data"); var dataina1 = sh1.getrange('a1');   if (dataina1 = 5) { sh2.getrange('b1').setvalue("five"); }  } 

i corrected problem.

//var ss = spreadsheetapp.openbyid("id_spreadsheet"); var ss = spreadsheetapp.getactivespreadsheet(); var sh1 = ss.getsheetbyname("downloader"); var sh2 = ss.getsheetbyname("data"); var value = sh1.getrange("a1").getvalue();   // add .getvalue()    if (value = 5) {     sh2.getrange('b1').setvalue("five");   } 

worked me.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -