Starting from version 4.2, dhtmlxScheduler provides a possibility to export all data from the scheduler to the Excel and iCal formats.
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.
To export scheduler's data to an Excel document, do the following steps:
<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">
<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>
The exportToExcel() method takes as a parameter an object with several properties (all of the properties are optional):
name | (string) the name of the output file with the extension '.xlsx' |
columns | (array) configures columns of the output sheet
|
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/scheduler |
start | (string|object) sets the start date of the data range that will be presented in the output |
end | (string|object) sets the end date of the data range that will be presented in the output |
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)
});
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.
To export scheduler's data to an iCal string, do the following steps:
<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">
<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>
The exportToICal() method takes as a parameter an object with the following property (optional):
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/scheduler |
Calling the export method with optional properties
scheduler.exportToICal({
server:"https://myapp.com/myexport/scheduler"
});
Back to top