Skip to content

Commit

Permalink
fix: xls export
Browse files Browse the repository at this point in the history
  • Loading branch information
makiJS committed Jun 25, 2024
1 parent 6aa81d6 commit 75ebbd3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions functions/src/rest/export-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,13 @@ app.post('/**', authenticated(), (req, res) => {
};

case Type.xls:
const data = XLSX.utils.json_to_sheet(docs, {header: appliedColumns.map(({label}) => label)});
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, data, "Sheet1");
const sheetBuffer = XLSX.write(wb, {bookType: "xlsx", type: "buffer"});
return {
data: XLSX.utils.json_to_sheet(docs),
type:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
data: sheetBuffer,
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
};

case Type.csv:
Expand Down

0 comments on commit 75ebbd3

Please sign in to comment.