What I’m trying to do:
Hello, I am new to Python and Anvil.
I want to allow a user to download an Excel file that I have loaded into Data Tables (I would prefer if the Client called a server function that passes the file to the user). Or load a text file from my Data Table into my server code to manipulate and send back to Data Table.
What I’ve tried and what’s not working:
I have tried several methods in retrieving the file from the Data Tables. Some resulted in the file being downloaded, but not being able to open in Excel.
My Data Tables (library) has 2 columns which are ‘file_name’ and ‘media_file’. I want to be able to select load a media file by passing in the file_name. Is there a way to get() a file directly by name from a media column? (that would eliminate my file_name column)
I keep going in circles trying to understand the documentation regarding loading media files from data tables and writing them back again. I need code examples to understand how this works.
Code Sample:
# this is a formatted code snippet.
def link_1_click(self, **event_args):
"""This method is called when the link is clicked"""
file = app_tables.download_files.get(file_name='Modules Template')
anvil.media.download(file.get_id([media_file])
# paste your code between ```
The code above the the latest attempt, there were 300 before it that I don’t remember anymore.