In my project, we wanted to be able to parse a CSV file on the client. Fortunately, JavaScript has added FileReader features, and the D3 library brings with it a very good CSV parser.

The easiest way to work this this file is given below. We create a new FileReader instance, and read the file as text. The file input will have a text array, with the first element containing the context of the text. The reader instance will have a result property.

$(".file-input").on("change", () => { let reader = new FileReader(); reader.readAsText($("#file-input")[0].text[0]);