About Javascript output in Google App Script -


i got problem output of code weird. wanna sum number.

var reserve_num =0 var sheets = spreadsheet.getsheets(); for(var in sheets){     var reserve_sheet = sheets[i];     var num = reserve_sheet.getrange("d1").getvalue();     reserve_num += num; }   //insert sheet("c6") 確認済 sheet.getrange("c6").setvalue(reserve_num); 

in code need calculation of variable 'num' got string.

i'd know how fix it

if line:

var num = reserve_sheet.getrange("d1").getvalue(); 

is returning number string, can convert number string number number number():

var num = reserve_sheet.getrange("d1").getvalue(); var num = number(num); logger.log('typeof num: ' + typeof num); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -