I'm making a small website using Flask, with a SQLite database. One of the things I want to do is take some data (from the database) and export it as an Excel file. I want to offer an option of downloading that Excel file. One option to do this is to use Pandas to write to an Excel file which would be stored on the web server, and to use Flask's send_file
to offer the download option.
However, is it possible to provide a downloadable Excel file without storing the file "locally" on the server? For example on AWS S3. I want to have predictable storage size on the web server. (And just see if it's possible, in any case.)
One option might be to write to a file "locally", then send it to AWS, then delete it from the server. Ideally I'd rather capture the file stream directly and then send that to S3, but I don't think that's possible, since to_excel
only takes a file path (or an ExcelWriter
object, but that takes a file path).