By the way for those that are interested, we ended up using ExcelJS
instead of SheetJS because it has a nice API for styles and tables.
You can add it to the Script and Styles > Libraries
: https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.3.0/exceljs.js
And then use it for example like this in a JS query:
async function exportData() {
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet('My Sheet');
sheet.addTable({
name: 'MyTable',
ref: 'A1',
style: { theme: 'TableStyleDark3', showRowStripes: true },
columns: [{ name: 'Date' }, { name: 'Amount' }],
rows: [
[new Date('2019-07-20'), 70.10],
[new Date('2019-07-21'), 70.60],
[new Date('2019-07-22'), 70.10],
],
});
const buffer = await workbook.xlsx.writeBuffer()
utils.downloadFile({ base64Binary: buffer.toString('base64')}, "file-name", "xlsx")
}
return exportData()