Save Data in Current State

Hello Retool community,

I have an app that lets users upload csv file in Google sheets. It then pulls data from Google sheets and creates charts and tables. But the data doesn’t save your data in Retool. It disappears as soon as the app is refreshed. I tried adding SaveLocalState, but it’s not working. How can I save the data till the users upload a new csv file? Will this need workflows? Any pointer is appreciated!!

Yes, you can save your data to localstorage. you can use JSON.stringify to make your data to string. and save them. Then you can use JSON.parse to parse them to json after read them.

Here is doc of localstorage.

Thanks @AnsonHwang . I tried using JSON.parse(JSON.stringify(item) in a query and it didn't work. I am confused what should go in 'item'.

Hi, I write a demo app json for your referrence, you can import it to your app and check it.


I
SaveToLocalstorage.json (15.2 KB)

Here is testing data
data.csv (45 Bytes)

1 Like