function http(method, remote, callback, body) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4 callback(xmlhttp.responseText, xmlhttp.status) } }; xmlhttp.open(method, remote, true); if (typeof body == "undefined") { body = null } xmlhttp.send(body); } function populate_schedule(csv, status_code) { console.log("status_code", status_code) csv = csv.split("\n") var first = true; var table = ""; for (var i in csv) { table += "\n" i = csv[i].split('","') for (var j in i) { j = i[j] j = j.replace(/(^"|"$)/g, "") table += first ? "" : "" table += j table += first ? "" : "" } table += "\n" first = false; } document.getElementById("schedule").innerHTML = table } var cors_anywhere = "https://cors-anywhere.herokuapp.com" var google_doc_pre = "https://docs.google.com/spreadsheets/d/" var google_doc_id = "14F7zRrwGT6JkCeZqZLPM2r2GScrm9FLFxlPtDINbNWg" var google_doc_post = "/gviz/tq?tqx=out:csv" //"https://www.googleapis.com/drive/v3/files/14F7zRrwGT6JkCeZqZLPM2r2GScrm9FLFxlPtDINbNWg/export?mimeType=text/csv&key=AIzaSyCFIWSe7vBnZ-1KRR9yVMbCPW08oCOHRJI", http( "get", `${cors_anywhere}/${google_doc_pre}/${google_doc_id}/${google_doc_post}`, populate_schedule, JSON.stringify({"cc": "cc"}), )