-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent.js
33 lines (32 loc) · 919 Bytes
/
student.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// let fa=[
// {path:"Child Details (Responses) - Form Responses 1.csv",head:"CSV1"}
// ]
// for(let i=0;i<fa.length;i++){
// document.querySelector('body').innerHTML
// +=`
// <table id="table${i}"><thead>
// <tr>
// <th>${fa[i].head}</th>
// </tr></thead>
// </table>`;
// }
const x=document.querySelector("input");
x.addEventListener("change",()=>{
const fr=new FileReader();
fr.onloadend=e=>{
let r=fr.result.split("\n").map(e=>{
return e.split(",")
});
r.forEach(e => {
let m=e.map(e=>{
return `<td>${e}</td>`;
}).join("");
console.log(m)
const ce=document.createElement('tr');
ce.innerHTML=m;
document.querySelector("table").append(ce);
});
// console.log(r);
}
fr.readAsText(x.files[0]);
})