web-csv-toolbox - v0.14.0
    Preparing search index...

    Function parseFileToArray

    • Parse CSV from a File to array of records.

      Type Parameters

      • Header extends readonly string[]

      Parameters

      Returns Promise<CSVObjectRecord<Header>[]>

      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);
      });