GAS PropertiesService to Save and Return Sort Order

前端 未结 2 1398
栀梦
栀梦 2021-01-16 01:28

QUESTION

How can I use PropertiesService to store an array from index.html, send the array to code.gs, and re

2条回答
  •  半阙折子戏
    2021-01-16 02:12

    It's also possible to just use the browser's localStorage client side.

    localStorage.setItem('id', positions); //Store positions in users browser
    localStorage.getItem('id'); //Retrieve the stored positions later
    

    Notes:

    • For this to work, the url(document.domain of the iframe="*.googleusercontent.com") from which your script is deployed must remain constant. During my brief testing, it was constant even when changing from /dev to /exec of the parent(script.google.com) and even during version update. But there's no official reference.

    • This solution is better than properties service, if you have multiple users, as each one will have their own data stored in their own browsers and there are no server calls during each change.

提交回复
热议问题