exports data from the Gantt chart to an Excel document

void exportToExcel(object export);


exportobjectan object with export settings (see the details)


        { id:"text",  header:"Title", width:150 },
        { id:"start_date",  header:"Start date", width:250, type:"date" }


This method is defined in the export extension, so you need to include it on the page:

<script src="http://export.dhtmlx.com/gantt/api.js"></script>

Read the details in the Export/Import for Excel, Export to iCal article.

The exportToExcel() method takes as a parameter an object with several properties (all the properties are optional):

  • name - (string) sets the name of the output file with the extension '.xlsx'
  • columns - (array) allows configuring columns of the output Excel sheet. The properties of the column objects are:
    • 'id' - (string,number) a property of the event that will be mapped to the column
    • 'header' - (string) the column header
    • 'width' - (number) the column width in pixels
    • 'type' - (string) the column type
  • server - (string) sets the API endpoint for the request. Can be used with the local install of the export service. The default value is https://export.dhtmlx.com/gantt
  • visual - (boolean) adds the timeline chart to an exported Excel document. false by default
  • cellColors - (boolean) if set to true, the cells of the exported document will have the colors defined by the timeline_cell_class template, the color and background-color properties are exported
  • data - (object) sets a custom data source that will be presented in the output Gantt chart
See also
Back to top