Export to Excel and iCal

Starting from version 4.2, dhtmlxScheduler provides a possibility to export all data from the scheduler to the Excel and iCal formats.

Limits on request size

There is a common API endpoint https://export.dhtmlx.com/scheduler which serves for export methods (exportToPDF, exportToPNG, etc.). Max request size is 10 MB.

Export to Excel

To export scheduler's data to an Excel document, do the following steps:

  1. Include the "https://export.dhtmlx.com/scheduler/api.js" file on the page to enable the online export service:
    <script src="codebase/dhtmlxscheduler.js"></script>
    <script src="https://export.dhtmlx.com/scheduler/api.js"></script>  <link rel="stylesheet" href="codebase/dhtmlxscheduler.css" type="text/css">
  2. Call the exportToExcel method to export the scheduler's data:
    <input value="Export to Excel" type="button" onclick="scheduler.exportToExcel()"> 
    <script>
        scheduler.init("scheduler_here",new Date(2019,5,30),"month");
        scheduler.load("data/events");
    </script>

Parameters of the export method

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


Calling the export method with optional properties

scheduler.exportToExcel({
    name:"My document.xls", 
    columns:[
        { id:"text",  header:"Title", width:150 },
        { id:"start_date",  header:"Start date", width:250 }
    ],
    server:"https://myapp.com/myexport/scheduler",
    start: new Date(1999, 01, 01),
    end:  new Date(2022, 01, 01)
});

Setting date format

To specify the format in which dates will be exported to an Excel file, use the xml_format template:

scheduler.templates.xml_format = scheduler.date.date_to_str("%Y-%m-%d %H:%i");

Related sample:  Setting date format

See the date format specification here.

Export to iCal

To export scheduler's data to an iCal string, do the following steps:

  • Include the "https://export.dhtmlx.com/scheduler/api.js" file on the page to enable the online export service:
<script src="codebase/dhtmlxscheduler.js"></script>
<script src="https://export.dhtmlx.com/scheduler/api.js"></script>  <link rel="stylesheet" href="codebase/dhtmlxscheduler.css" type="text/css">
  • Call the exportToICal method to export the scheduler's data:
<input value="Export to iCal" type="button" onclick="scheduler.exportToICal()"> 
<script>
    scheduler.init("scheduler_here",new Date(2019,5,30),"month");
    scheduler.load("data/events");
</script>

Parameters of the export method

The exportToICal() method takes as a parameter an object with the following property (optional):


Calling the export method with optional properties

scheduler.exportToICal({
    server:"https://myapp.com/myexport/scheduler"
});
Back to top