This creates an upload button that will either:
allow you to upload any file
take any CSV file and parse it into a Javascript array
take a Javascript array and parse as CSV
Since there are no libraries for this and remembering how to bind things correctly can be a bother why not offer this:
import UploadCSV from 'upload-csv-svelte';
<UploadCSV allowedFileExtensions={['png', 'jpeg', 'gif']} onUpload={(file) => console.log("this is the uploaded file: ", file)} >
import UploadCSV from 'upload-csv-svelte';
<UploadCSV onUpload={(file) => console.log("this is the parsed file: ", file)} />
import UploadCSV from 'upload-csv-svelte';
<UploadCSV onUpload={(csvData) => console.log("this is the parsed data converted to CSV: ", csvData)} dataToCSV={[["hello", "nice"], ["convert", "to", "csv"]]} />
Open an issue on Github.