Skip to content

Instantly share code, notes, and snippets.

View vonox7's full-sized avatar

Valentin Slawicek vonox7

View GitHub Profile
@maciejjankowski
maciejjankowski / download table to excel csv.js
Last active March 23, 2025 20:07
download table to excel csv.js. Charset MUST be UTF-16LE - this is the only solution that worked with Excel on Mac
function exportTableToCSV($table, filename) {
var $rows = $table.find('tr:has(td,th)'),
// Temporary delimiter characters unlikely to be typed by keyboard
// This is to avoid accidentally splitting the actual contents
tmpColDelim = String.fromCharCode(11), // vertical tab character
tmpRowDelim = String.fromCharCode(0), // null character
// actual delimiter characters for CSV format