google.script.run.withSuccessHandler(arr).test()
I am developing a web app based on google sheets.
The test function returns an array (arr in this example), which is populated from a range of values in the spreadsheet.
The goal is, in the client-side, when the user clicks a button, it brings the next element of the array.
I am trying to make the returned array a global one so as the server-side function (google.script.run) does not run each time the user clicks the button. I made few attempts to make this array global to no avail.
To give more context, this a multi-dimentional array. Something like: [[2022-01-07, $1,645.00, John, 1.0], [2022-01-08, $1,725.00, John, 2.0]]
So, when the user (John) clicks on a button to see values from 2022-01-07, he will be presented with these values. When he clicks to advance the date one more day, he will be presented with the values from 2022-01-08 and so on.
I would like to run the sever-side script only once, have all its elements available at the client side, so when the user changes the date, there is no need to run server-side script. Thank you for your help.