I have saved my database as text and csv file under server session variables.
anvil.server.session[‘df_final_txt’]= df_final.to_string(index=False) -------> A
anvil.server.session[‘df_final_csv’]= df_final.to_csv(index=False) --------> B
df_final will get generated everytime someone uses the web application. Therefore it is static, but will be generated with different values based on user input.
I would like to make A and B downloadable as text and csv files by clicking their respective buttons.
To be honest, I don’t know where to start. I have the buttons and session variables ready, but no idea on how to make it downloadable. Is there a function that can facilitate with this ?
I have tried looking online but still cannot understand it.
Sorry, I have only worked with python. Deploying it online is new to me.
Ah Ok, I understand, this is probably not what you want.
(The session variables are for small amounts of data, databases are usually not considered ‘small’)
You probably want to use the server modules like this:
And in the Client (the part that the user will see from a web page) you can call the server function and have it return the data you want to display, or a downloadable link that you can put on the client form. Or a button, etc.
Most of the tutorials will get you started with the client / server concepts, how to drag and drop and interact with the buttons through code and the like.
You can also look around the forums, there are a ton of clone links with example apps as well.