google apps script - setNumberFormats not working properly for percentages -


i have google spreadsheet in want copy values 1 range range using script. copying values isn't hard; use range.setvalues(valuestocopy). want copy formatting of original range on new range. problem whenever percentage occurs, doesn't apply format correctly , ends off factor of 100. example, if original cell contains value of 0.5545, formatting of cell turns 55.45% (which want); however, when copy values range , apply formatting setnumberformats(), turns 0.5545%. how can fix this?

edit: so, after bit more fiddling around, appears script copies formatting on first time, on subsequent executions of script, formatting percentages gets messed up, explained above.

to copy values, use .copyto method, , format preserved default. example,

rangefrom.copyto(rangeto) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -