| sidebar_label | xlsx() |
|---|---|
| title | xlsx export method |
| description | Export the data of DHTMLX Spreadsheet into an Excel (.xlsx) file with the export.xlsx() method, optionally with a custom file name. |
@short: Exports data from a spreadsheet into an Excel (.xlsx) file
xlsx(name:string): void;name- (optional) the name of an exported .xlsx file
const spreadsheet = new dhx.Spreadsheet("spreadsheet_container", {
// config parameters
});
spreadsheet.parse(data);
// exports data from a spreadsheet into an Excel file
spreadsheet.export.xlsx();
// exports data from a spreadsheet into an Excel file with a custom name
spreadsheet.export.xlsx("MyData");:::note
Note that the component supports export to Excel files with the .xlsx extension only.
:::
Besides cell values, an exported file keeps the cell styles, the number formats, the merged cells, the frozen columns and rows, the links, the drop-down editors, and the locked state of cells. All of them are restored on import of the file back into Spreadsheet.
:::info DHTMLX Spreadsheet uses the WebAssembly-based library Json2Excel to export data to Excel. Check the details. :::
Related article: Data loading and export
Related sample: Spreadsheet. Export Xlsx