Created
March 18, 2026 16:52
-
-
Save dlebech/41422fd7981fc32d157e7cf21ee91633 to your computer and use it in GitHub Desktop.
Download CSV string that works with Excel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function downloadCsv(csv: string, filename: string) { | |
| // BOM is necessary for Excel to recognize the file as UTF-8. Very strange. | |
| const BOM = new Uint8Array([0xef, 0xbb, 0xbf]); | |
| const blob = new Blob([BOM, csv], { type: "text/csv" }); | |
| downloadBlob(blob, filename); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment