Here's a download function that works for dataframes and txt

Possible solution: