TableExport
TableExport copied to clipboard
Pass data from JSON
trafficstars
I want to pass data dynamically constructed from array like in these 2 situations:
var data = [
{field1: "...", field2: "...", ...},
...
]
- or
var data = {
fields: ["field1", "field2", ...],
records: [
["...", "...", ...], // follows the order of fields
...
]
- or
var fields = ["field1", "field2", ...];
var records = [
["...", "...", ...], // follows the order of fields
...
];
Describe the solution you'd like Ideally I prefer the 2nd/3rd constructs so that one can call
/////NEW FEATURE//////
var table = TableExport(fields, records);
// or
table = TableExport({fields: fields, records: records});
//////ALREADY APPLIES////////
/* convert export data to a file for download */
var exportData = table.getExportData();
var xlsxData = exportData.table.xlsx; // Replace with the kind of file you want from the exportData
table.export2file(xlsxData.data, xlsxData.mimeType, xlsxData.filename, xlsxData.fileExtension, xlsxData.merges, xlsxData.RTL, xlsxData.sheetname)
Describe alternatives you've considered Hack the code!
Additional context Add any other context or screenshots about the feature request here.