javascript - How can I call a function all the time in a Google Spreadsheet cell? -
here problem:
i created function on google script:
function lastcolelement(colindex) { // gets whole spreadsheet var ss = spreadsheetapp.getactivespreadsheet(); var registersheet = ss.getsheetbyname("registro de inventario"); // returns last element of colindex column return registersheet.getrange(registersheet.getlastrow(), colindex).getvalue() }
and called in spreadsheet as:
=lastcolelement(1)
the output correct , gives me want, add row "registro de inventario" sheet, "=lastcolelement(1)" still shows being showing before because hasn't been called again.
if delete "=lastcolelement(1)" , re-write again shows last element.
i've been thinking while , don't know how fix this.
google sheet caches result, , not recall function , not refresh data, because formula parameter (1)
not change, google inferes result not change neither; eventhough data being used change, beyond google sheet inspection.
you might either used (or educate users) make manual refresh (with ctrl-r)
or force data reload trick. add unused parameter function function lastcolval(colindex,fakecell)
, pass reference cell =lastcolval(1,$a$1)
. eventhough function not use value, mere presence make google sheet refresh data. then, force refresh every time add row, change value of a1 cell, example, count of nonblank cells.
Comments
Post a Comment