Exporting data
To export the table data to the XLSX or CSV format, it's necessary to get access to the underlying Table widget instance inside Pivot and apply its API to export data. To do this, you should use the getTable
method and execute the export
event.
In the example below we get access to the Table instance and trigger the export
action using the api.exec()
method.
const widget = new pivot.Pivot("#root", { /*setting*/});
widget.api.getTable().exec("export", {
options: {
format: "csv",
cols: ";"
}
});
widget.api.getTable().exec("export", {
options: {
format: "xlsx",
fileName: "My Report",
sheetName: "Quarter 1",
}
});
Example
In this snippet you can see how to export data:
Related articles: