jQuery Scheduler: iCalendar Import

jqxScheduler imports iCalendar (.ics) files from Google Calendar, Outlook, Apple Calendar or Thunderbird with the importData method - time zones, recurring events and their exceptions, all-day events and statuses included - and exports its appointments with exportData.

A live JavaScript/jQuery example of jqxScheduler, the jQWidgets Scheduler component, with its complete source code below. It is one of 45 jqxScheduler demos for jQuery.

jqxScheduler API used in this demo

Source code

To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxScheduler shows the setup step by step.

The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxbuttons.js, jqxscrollbar.js, jqxdata.js, jqxdata.export.js, jqxdate.js, jqxscheduler.js, jqxscheduler.api.js, jqxdatetimeinput.js, jqxmenu.js, jqxcalendar.js, jqxtooltip.js, jqxwindow.js, jqxcheckbox.js, jqxlistbox.js, jqxdropdownlist.js, jqxnumberinput.js, jqxradiobutton.js, jqxinput.js.

It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).

script.js

$(document).ready(function () {
    // a calendar as Google Calendar exports it: a weekly meeting in New York time with one
    // week cancelled and one moved, an all-day event that leaves the time free, and an
    // Outlook appointment in Pacific time
    var sample = [
        'BEGIN:VCALENDAR',
        'VERSION:2.0',
        'PRODID:-//Google Inc//Google Calendar 70.9054//EN',
        'BEGIN:VEVENT',
        'UID:design-sync@example.com',
        'DTSTART;TZID=America/New_York:20261116T090000',
        'DTEND;TZID=America/New_York:20261116T100000',
        'RRULE:FREQ=WEEKLY;BYDAY=MO,WE;COUNT=8',
        'EXDATE;TZID=America/New_York:20261118T090000',
        'SUMMARY:Design sync',
        'DESCRIPTION:Weekly review of the design work.\\nAgenda in the shared folder.',
        'LOCATION:Room 2',
        'END:VEVENT',
        'BEGIN:VEVENT',
        'UID:design-sync@example.com',
        'RECURRENCE-ID;TZID=America/New_York:20261123T090000',
        'DTSTART;TZID=America/New_York:20261123T113000',
        'DTEND;TZID=America/New_York:20261123T123000',
        'SUMMARY:Design sync (moved)',
        'END:VEVENT',
        'BEGIN:VEVENT',
        'UID:offsite@example.com',
        'DTSTART;VALUE=DATE:20261119',
        'DTEND;VALUE=DATE:20261121',
        'SUMMARY:Team offsite',
        'TRANSP:TRANSPARENT',
        'END:VEVENT',
        'BEGIN:VEVENT',
        'UID:budget@example.com',
        'DTSTART;TZID="Pacific Standard Time":20261117T080000',
        'DURATION:PT1H30M',
        'SUMMARY:Budget review\\, Q1',
        'STATUS:TENTATIVE',
        'END:VEVENT',
        'END:VCALENDAR'
    ].join('\r\n');

    var source = new $.jqx.dataAdapter({ dataType: 'array', dataFields: [{ name: 'id', type: 'string' }], localData: [] });
    $("#scheduler").jqxScheduler({
        date: new $.jqx.date(2026, 11, 17),
        width: '100%',
        height: 560,
        source: source,
        view: 'weekView',
        views: [
            { type: 'dayView', timeRuler: { formatString: 'HH:mm' } },
            { type: 'weekView', timeRuler: { formatString: 'HH:mm' } },
            'monthView'
        ],
        // file name of exportData
        exportSettings: { fileName: "schedule" },
        ready: function () {
            importText("Sample calendar", sample);
        }
    });

    // what importData did: { added, updated, skipped: [{ uid, reason }] }
    function report(name, result) {
        var text = name + ": " + result.added.length + " added, " + result.updated.length + " updated";
        if (result.skipped.length) {
            text += ", " + result.skipped.length + " skipped (" + $.map(result.skipped, function (s) { return s.uid + ": " + s.reason; }).join("; ") + ")";
        }
        $("#status").text(text + ".");
    }

    function importText(name, text) {
        var result = $("#scheduler").jqxScheduler('importData', text);
        report(name, result);
        // the working day, then the first imported appointment if it is outside it
        $("#scheduler").jqxScheduler('scrollToTime', 8);
        if (result.added.length) {
            $("#scheduler").jqxScheduler('ensureAppointmentVisible', result.added[0].id);
        }
    }

    $("#sample, #import, #export").jqxButton();
    $("#sample").on('click', function () {
        importText("Sample calendar", sample);
    });
    $("#import").on('click', function () {
        $("#file").val('').trigger('click');
    });
    $("#file").on('change', function () {
        var file = this.files && this.files[0];
        if (!file) {
            return;
        }
        var reader = new FileReader();
        reader.onload = function () {
            importText(file.name, reader.result);
        };
        reader.readAsText(file);
    });
    $("#export").on('click', function () {
        $("#scheduler").jqxScheduler('exportData', 'ics');
    });
});

body.html

<div id="content" class="demo">
<div class="demo-bar">
    <input type="button" id="import" value="Import .ics file">
    <input type="file" id="file" accept=".ics,text/calendar" aria-label="iCalendar file">
    <input type="button" id="export" value="Export .ics">
    <input type="button" id="sample" value="Import the sample again">
</div>
<div id="scheduler"></div>
<div id="status" class="demo-status" role="status" aria-live="polite"></div>

</div>

Learn more

More jQuery Scheduler demos