blog.minskio.co.uk

Content and theme behind minskio.co.uk
Log | Files | Refs

webex-bulk-uk-bank-holidays.md (6344B)


      1 ---
      2 title: "Webex bulk UK bank holidays generator"
      3 date: 2026-08-13T12:59:00
      4 tags: ["Downloads", "Tools", "Work"]
      5 ---
      6 
      7 For pretty much every Webex site I build I end up manually adding [UK bank holiday dates](https://www.gov.uk/bank-holidays), this page generates that list (up until 2028). Just fill in the Location name, click download, then upload them via `Management > Locations > Location Name > Calling > Calling features settings > Schedules > Bulk Manage > Upload .csv data`.
      8 
      9 If you want to build your own, check out the source code and the dates are defined in an ISO-8601 const block.
     10 
     11 <label for="location">Location</label>
     12 <input type="text" id="location" placeholder="Enter location" >
     13 <button id="generateButton">Download CSV</button>
     14 
     15 <div id="status"></div>
     16 
     17 <script>
     18 
     19     /* Bank holiday dates in ISO-8601 standard */
     20     const bankHolidayDates = [
     21         "2026-08-31",
     22         "2026-12-25",
     23         "2026-12-28",
     24         "2027-01-01",
     25         "2027-03-26",
     26         "2027-03-29",
     27         "2027-05-03",
     28         "2027-05-31",
     29         "2027-08-30",
     30         "2027-12-27",
     31         "2027-12-28",
     32         "2028-01-03",
     33         "2028-04-14",
     34         "2028-04-17",
     35         "2028-05-01",
     36         "2028-05-29",
     37         "2028-08-28",
     38         "2028-12-25",
     39         "2028-12-26"
     40     ];
     41 
     42 
     43     /* CSV Headers */
     44     const headers = [
     45         "Name",
     46         "Location",
     47         "Schedule action",
     48         "Schedule type",
     49         "Event action"
     50     ];
     51 
     52 
     53     // Add the 10 event groups.
     54     for (let i = 1; i <= 10; i++) {
     55 
     56         headers.push(
     57             `Event ${i} name`,
     58             `Event ${i} start date`,
     59             `Event ${i} end date`,
     60             `Event ${i} start HOLIDAY`,
     61             `Event ${i} end HOLIDAY`,
     62             `Event ${i} recurrence type`,
     63             `Event ${i} day of recurrence by week`,
     64             `Event ${i} day of yearly recurrence by day`,
     65             `Event ${i} week of yearly recurrence by day`,
     66             `Event ${i} month of yearly recurrence by day`,
     67             `Event ${i} date of yearly recurrence by date`,
     68             `Event ${i} month of yearly recurrence by date`
     69         );
     70     }
     71 
     72     function isoToAmericanDate(isoDate) {
     73 
     74         const [year, month, day] = isoDate.split("-");
     75 
     76         return `${month}/${day}/${year}`;
     77     }
     78 
     79     function csvEscape(value) {
     80 
     81         if (value === null || value === undefined) {
     82             return "";
     83         }
     84 
     85         const text = String(value);
     86 
     87         if (
     88             text.includes(",") ||
     89             text.includes('"') ||
     90             text.includes("\n") ||
     91             text.includes("\r")
     92         ) {
     93             return `"${text.replace(/"/g, '""')}"`;
     94         }
     95 
     96         return text;
     97     }
     98 
     99 
    100     /* Create event 1 CSV */
    101 
    102     function createRow(location, isoDate) {
    103 
    104         const americanDate =
    105             isoToAmericanDate(isoDate);
    106 
    107         const row = [
    108 
    109             // Event 1
    110             "Bank Holidays",
    111             location,
    112             "ADD",
    113             "HOLIDAY",
    114             "ADD",
    115 
    116             isoDate,          // Event 1 name
    117             americanDate,     // Event 1 start date
    118             americanDate,     // Event 1 end date
    119             "12:00",          // Event 1 start HOLIDAY
    120             "14:00",          // Event 1 end HOLIDAY
    121             "NONE",           // Event 1 recurrence type
    122             "",               // Event 1 day of recurrence by week
    123             "",               // Event 1 day of yearly recurrence by day
    124             "",               // Event 1 week of yearly recurrence by day
    125             "",               // Event 1 month of yearly recurrence by day
    126             "",               // Event 1 date of yearly recurrence by date
    127             ""                // Event 1 month of yearly recurrence by date
    128         ];
    129 
    130 
    131         // Events 2–10
    132         for (let i = 2; i <= 10; i++) {
    133 
    134             for (let field = 0; field < 12; field++) {
    135                 row.push("");
    136             }
    137         }
    138 
    139 
    140         return row;
    141     }
    142 
    143     function generateCSV(location) {
    144 
    145         const rows = [];
    146 
    147         rows.push(headers);
    148         for (const isoDate of bankHolidayDates) {
    149 
    150             rows.push(
    151                 createRow(location, isoDate)
    152             );
    153         }
    154 
    155         return rows
    156             .map(row =>
    157                 row
    158                     .map(csvEscape)
    159                     .join(",")
    160             )
    161             .join("\r\n");
    162     }
    163 
    164     function downloadCSV(csv, location) {
    165 
    166         const blob = new Blob(
    167             ["\uFEFF" + csv],
    168             {
    169                 type: "text/csv;charset=utf-8;"
    170             }
    171         );
    172 
    173         const url =
    174             URL.createObjectURL(blob);
    175 
    176         const link =
    177             document.createElement("a");
    178 
    179         link.href = url;
    180 
    181         // Clean location for filename.
    182         let filename =
    183             location
    184                 .trim()
    185                 .replace(/[^a-z0-9]+/gi, "_")
    186                 .replace(/^_+|_+$/g, "");
    187 
    188         if (!filename) {
    189             filename = "Location";
    190         }
    191 
    192         link.download =
    193             `Bank_Holidays_${filename}.csv`;
    194 
    195         document.body.appendChild(link);
    196 
    197         link.click();
    198 
    199         document.body.removeChild(link);
    200 
    201         URL.revokeObjectURL(url);
    202     }
    203 
    204     document
    205         .getElementById("generateButton")
    206         .addEventListener("click", function () {
    207 
    208             const location =
    209                 document
    210                     .getElementById("location")
    211                     .value
    212                     .trim();
    213 
    214             const status =
    215                 document.getElementById("status");
    216 
    217 
    218             if (!location) {
    219 
    220                 status.style.display = "block";
    221                 status.style.background = "#fff0f0";
    222                 status.style.color = "#8a1f1f";
    223 
    224                 status.textContent =
    225                     "Please enter a Location.";
    226 
    227                 return;
    228             }
    229 
    230 
    231             const csv =
    232                 generateCSV(location);
    233 
    234 
    235             downloadCSV(
    236                 csv,
    237                 location
    238             );
    239 
    240             status.style.display = "block";
    241             status.style.background = "#eef8ee";
    242             status.style.color = "#276327";
    243 
    244             status.textContent =
    245                 `CSV generated successfully for "${location}". ` +
    246                 `${bankHolidayDates.length} holiday rows created.`;
    247         });
    248 
    249 </script>