CSVFileReader
No file chosen
fileInput.addEventListener('change', () => { content.innerHTML = ''; fileText.innerHTML = fileInput.value.replace(/^.*[\\\/]/, ''); const file = fileInput.files[0]; const reader = new CSVFileReader(file); document.querySelector('x-overlay').dispatchEvent(new CustomEvent('show', { detail: { spin: 'true' }})); reader.load().then((data) => { data.forEach(line => { const tr = document.createElement('tr'); line.forEach(col => { const td = document.createElement('td'); td.textContent = col; tr.appendChild(td); }); content.appendChild(tr); }); document.querySelector('x-overlay').dismiss(); }).catch(err => { document.querySelector('x-overlay').stopSpin(); document.querySelector('x-overlay').setText(`Click to dismiss<br/>${err}`); }); });