https://github.com/samuelstevens/elm-csv
CSV parsing and escaping library for Elm.
https://github.com/samuelstevens/elm-csv
csv elm
Last synced: 6 months ago
JSON representation
CSV parsing and escaping library for Elm.
- Host: GitHub
- URL: https://github.com/samuelstevens/elm-csv
- Owner: samuelstevens
- License: bsd-3-clause
- Created: 2020-07-09T12:04:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T17:07:03.000Z (almost 5 years ago)
- Last Synced: 2023-08-08T20:40:05.783Z (over 2 years ago)
- Topics: csv, elm
- Language: Elm
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-csv
Parse CSV files according to [RFC 4180](https://tools.ietf.org/html/rfc4180) (including values with quoted commas).
## Install
```bash
elm install samuelstevens/elm-csv
```
## Quick Start
Suppose you have a file `star-wars-quotes.csv` with the following content:
```csv
quote,character
"Why, hello there",Obi-Wan Kenobi
"General Kenobi.",General Grievous
```
Once this is read into an Elm string, you could parse it like this:
```elm
import Csv
let
content =
"quote,character\n\"Why, hello there\",Obi-Wan Kenobi\n\"General Kenobi.\",General Grievous"
in
Csv.parseRows content --> Ok [[ "quote", "character"],["Why, hello there", "Obi-Wan Kenobi"],["General Kenobi.", "General Grievous"]]
```
Calling `Csv.parseCsv` will produce a list of lists of strings, properly escaped from their CSV representation.