Parse CSV from a File to array of records.
The file to parse
Optional
Parsing options
Promise of array of records
This function automatically sets the file name as the error source for better error reporting (unless explicitly overridden via options).
import { parseFileToArray } from 'web-csv-toolbox';const input = document.querySelector('input[type="file"]');input.addEventListener('change', async (event) => { const file = event.target.files[0]; const records = await parseFileToArray(file); console.log(records);}); Copy
import { parseFileToArray } from 'web-csv-toolbox';const input = document.querySelector('input[type="file"]');input.addEventListener('change', async (event) => { const file = event.target.files[0]; const records = await parseFileToArray(file); console.log(records);});
Parse CSV from a File to array of records.