I want the user to be able to select a single column CSV file, which then gets loaded in a 1D Javascript array.
I'm trying to do this with Papa Parse and when I try my code in a codepen it works, so the issue must be with the Chrome extension environment.
popup.html:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form id="csvForm">
<label for="avatar">Select a csv list:</label>
<input type="file" id="csvFile" accept=".csv">
<input type="submit" id="load" value="Load">
</form>
<script src="papaparse.min.js"></script>
<script src="popup.js"></script>
</body>
</html>
popup.js:
let loadButton = document.getElementById("load").addEventListener("click", () => {
Papa.parse(document.getElementById("csvFile").files[0], {
download: true,
header: false,
complete: function (results) {
console.log(results);
},
});
});