Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1662

Parse CSV in Svelte with papaparse

$
0
0

I'm trying to parse a local csv in svelte but the logged object has nothing to do with the parsed file. The file is in the /src/db-csv/folder.

+layout.server.js

import Papa from 'papaparse'export const load = async ({ params, fetch }) => {  const result = await fetch("http://localhost:5173/db-csv/customers.dat", {    headers: { "content-type": "text/csv;charset=UTF-8" },  });  const fileContent = await result.text();  let parsedCsvCstomers = Papa.parse(fileContent, {header: true})  return {    customers: parsedCsvCstomers.data  };};

Also the csv has 8000 rows, the array has less objects and It looks like it's reading the svelte page.

enter image description here


Viewing all articles
Browse latest Browse all 1662

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>