toExcel

exports data of a data component to an Excel document

object toExcel(string|object id, [object options] );

Parameters

idstring|objectthe exported view or its id
optionsobjectoptional, a set of configuration options that define what data will be displayed in the Excel file

Returns

objecta "promise" object. The promise is resolved with the contents of an Excel file that is ready for downloading.

Example

webix.toExcel($$("table"), {
     filename: "table", // for filename
     name: "Films", // for sheet name
     // more config options
});

Related samples

Details

The method returns all data specified in the columns parameter of the DataTable view. The data is exported into an Excel document with "Data" name and "Data" sheet name.

However, you may need to get some particular data, or customize file and sheet names.

Export API allows:

  1. providing a custom filename and sheet name
  2. stripping HTML tags from the cells
  3. setting custom columns for export
  4. defining custom header, width or template for data in the specified column
  5. including extra fields into export
  6. rendering raw values or templates set in the widget's dataset
  7. including column and row spans from Datatable header and body into export
  8. disabling file download in a browser, if necessary
  9. ignoring particular columns during export
  10. including cell styles from Datatable header and body into export
  11. exporting row heights
  12. omitting the header or footer of Datatable during export
  13. outputting certain data from a data set
  14. specifying the desired type of data and setting format for exported dates and numbers
See also
Back to top