According to this and other sources, the content-type for Excel files is application/vnd.ms-excel
for .xls files or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
for .xlsx files.
But... from your Bottle route I'm wondering whether you're intending to return a csv file, in which case use text/csv
.
Furthermore, (I think) you need to serialize workbook
to bytes (a string) before returning it. Bottle does not know how to return a Workbook
object. (Unless xlsxwriter.Workbook
exposes an iterator that serializes it to a csv string, which seems unlikely.)