csv parsing in Guile Scheme
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Nala Ginrut 929cedf9ff
use autogen.sh to add missing
11 years ago
build-aux use autogen.sh to add missing 11 years ago
csv fixed configure error when automake/autoconf newer than 1.12 11 years ago
.gitignore remove config.guess from .gitignore 11 years ago
AUTHORS Released v0.0.1 13 years ago
COPYING Released v0.0.1 13 years ago
ChangeLog Released v0.0.1 13 years ago
INSTALL use autogen.sh to add missing 11 years ago
Makefile.am fixed auto conf 13 years ago
Makefile.in updated Makefile.in and build-aux/missing 11 years ago
NEWS Released v0.0.1 13 years ago
README update README 13 years ago
README.md update README.md 13 years ago
autogen.sh use autogen.sh to add missing 11 years ago
configure fixed configure error when automake/autoconf newer than 1.12 11 years ago
configure.ac fixed configure error when automake/autoconf newer than 1.12 11 years ago
env.in Released v0.0.1 13 years ago
pkg-list.scm fixed auto conf 13 years ago

README.md

guile-csv

Guile csv reader

USAGE

install

./configure && make sudo make install

read csv

(use-modules (csv csv))
(define my-csv-reader (make-csv-reader #:\,))
(call-with-input-file "file.csv" my-csv-reader)

csv->xml

(call-with-input-file "file.csv" csv->xml)

and result could be:

<record-0>
 <name>aaa</name>
 <age>11</age>
 <email>aaa@aaa.com</email>
</record-0>
<record-1>
 <name>bbb</name>
 <age>12</age>
 <email>bbb@bbb.com</email>
</record-1>

sxml->csv or csv-write to output a csv format file

(call-with-output-file "file.csv"
 (lambda (port)
  (sxml->csv 
   '((name age email) ("aaa" "11" "aaa@aaa.com") ("bbb" "12" "bbb@bbb.com"))
   port)))

and file.csv would be:

name,age,email
aaa,11,aaa@aaa.com
bbb,12,bbb@bbb.com

Enjoy!