Skip to main content

xlsx()

Exports data from a grid to an Excel file

info

DHTMLX Grid uses the WebAssembly-based library Json2Excel for export of data to Excel. Check the details.

xlsx(config?: object): void;

Parameters:

  • config - (optional) an object with export settings. You can specify the following settings for export to Excel:
    • url?: string - (optional) the path to the worker.js file of the Json2Excel library (where export will be processed) set as "../libs/json2excel/1.3/worker.js?vx", if the local export server is used. The path to the public export server is used by default
    • name?: string - (optional) "grid" by default. The name of a ready Excel file
    • tableName?: string - (optional) "data" by default. The name of a sheet with grid data in the Excel file
    • dateFormatMask?: string - (optional) "dd/mm/yy" by default. The mask used for dates formatting in Excel

Example

// default export
grid.export.xlsx();

// export with config settings
grid.export.xlsx({
url: "../libs/json2excel/1.3/worker.js?vx", // a local path to the `worker.js` file of the export module
name: "my_file", // the name of a ready Excel file
tableName: "grid", // the name of a sheet with grid data in the Excel file
dateFormatMask: "mm.dd.yy" // the date format mask for Excel
});

Related samples: Grid. Export to xlsx and csv

Related article: Exporting Grid