kami-app / static /js /exportCsv.min.js
lterriel's picture
new structure
92da9af
raw
history blame
665 Bytes
function tableToCSV(){var csv_data=[];var rows=document.getElementsByTagName('tr');for(var i=0;i<rows.length;i++){var cols=rows[i].querySelectorAll('td,th');var csvrow=[];for(var j=0;j<cols.length;j++){csvrow.push(cols[j].textContent)}
csv_data.push(csvrow.join(","))}
csv_data=csv_data.join('\n');downloadCSVFile(csv_data)}
function downloadCSVFile(csv_data){let CSVFile=new Blob([csv_data],{type:"text/csv"});let temp_link=document.createElement('a');temp_link.download="kami_results.csv";temp_link.href=window.URL.createObjectURL(CSVFile);temp_link.style.display="none";document.body.appendChild(temp_link);temp_link.click();document.body.removeChild(temp_link)}