Download all table contents to a .csv

Try this:

if you have a string (Im guessing you do from the error: AttributeError: ‘str’ object… ) you will want to convert it it a media object so you can call it like this:

import anvil.media

text_file = anvil.BlobMedia('text/plain', b'Hello, world', name='hello.txt')
anvil.media.download(text_file)

In the example above b’Hello, world’ would be replaced by your string object like my_string_object.encode(), and you might want a different mime type other than text/plain but it will probably work for a csv file either way.

1 Like