JS

DISPLAY CSV AS HTML TABLE IN JAVASCRIPT

JUST AN HTML TABLE <table id="demo"></table>

THE HTML

01

GET HTML TABLE let t = document.getElementById("demo");   FETCH CSV & GENERATE TABLE fetch("FILE.CSV") .then((res) => { return res.text(); }) .then((csv) => {   t.innerHTML = "";   csv = csv.split("\r\n");   for (let row of csv) {     let tr = t.insertRow();     for (let col of row.split(",")) {       let td = tr.insertCell();       td.innerHTML = col;     }   } });

THE JAVASCRIPT

02