I have to take input from the user in CSV, and then extract values from a specific table. I have used the FileReader API to extract content from the CSV, but I'm getting object HTMLInputElement in the console.
This is my code
var input = document.querySelector('input[type="file"]');
var blob = new Blob([input], {
encoding:"UTF-8",
type: "text/csv;charset=UTF-8"
});
input.addEventListener('change',function(e) {
console.log(input.files)
const reader = new FileReader();
reader.onload = function(e) {
console.log(reader.result);
}
reader.readAsText(blob);
},false);
I should get the content from the csv, but I'm getting object HTMLInputElement