JSFiddle - React, Tailwind, and code Playground

by Dale Howard

HTML

<title>Sum of a Column in JavaScript</title>
    

    <input type="file" name="file" id="file">

JavaScript

document.getElementById('file').onchange = function(){

    var file = this.files[0];

    var reader = new FileReader();
    reader.onload = function(progressEvent){
    // Entire file
    console.log(this.result);

    // By lines
    var characters = this.result.split('');
    for(var line = 0; line < lines.length; line++){
        // By tabs
        var tabs = lines[line].split('\\t');
        for(var tab = 0; tab < tabs.length; tab++){    
                alert(tabs[tab]);
        }   
    }
  };
  reader.readAsText(file);
};