I think you are trying to store the entirely already created excel file in a database row?
I do this all the time, you are very close, you just need to turn your file into a media object to store in the data table like:
import anvil.media
excel_media_object = anvil.media.from_file(filename, name=filename)
app_tables.worksheets.add_row(
created=datetime.now(),
name=name,
worksheet=excel_media_object
)
Are you doing this on your own system using anvil-uplink
? Before I moved to a paid plan I used the uplink for things like using openpyxl
since it was not available using the free plan in server modules.
If you are using uplink, this should just work.