// A sales report as an Excel download, and the file read back.
//
//   quillo run spreadsheet.qwe      then open http://localhost:8080/report.xlsx

use "spreadsheet.qwer"

let sales = [["Region", "Orders", "Revenue"], ["North", 412, 18250.5], ["South", 380, 16410], ["East", 129, 5120.25]]

route GET /report.xlsx {
    write_xlsx("report.xlsx", "Sales", sales)?
    file("report.xlsx")
}
route GET /read {
    write_xlsx("report.xlsx", "Sales", sales)?
    { sheets: sheet_names("report.xlsx")?, rows: read_sheet("report.xlsx", "")? }
}
