Type to search…

CSV

Moltes dades que necessitem estan en format CSV

This page hasn't been translated yet — shown in its original language:Català

Introducció

En aquest enllaç tens el projecte de suport d’aquesta activitat: https://gitlab.com/xtec/ts/csv

Entorn de treball

Crea un projecte react:

shell
$ bun create vite csv --template react-swc-ts

PapaParse

PapaParse és un parser de dades CSV.

Afegeix una dependència amb papaparse

shell
$ bun add papaparse 
$ bun add --dev @types/papaparse

Afegeix aquest import al fitxer index.ts:

ts
import Papa from 'papaparse'

Imagina’t que tenim aquestes dades CSV:

ts
const csv = `name,age,email
John,32,jonn@gmail.com
Ruth,51,ruth@gmail.com`

You're reading a preview.

Sign in to read the full article. Any account opens 4 free articles a month; students and teachers read their course pages without limit.

Sign in