Re: csv (comma separated value) file



On Mon, Aug 3, 2009 at 1:21 PM, Liam R E Quin<liam holoweb net> wrote:
On Mon, 2009-08-03 at 12:45 -0400, Tristan Van Berkom wrote:
[...]
Currently its pretty easy using g_file_get_contents()/g_strsplit()

CSV files are not just comma separated, and in some cases can have
column headers and other metadata.  There's also escaping.

a,b,c\d,e
a,b,"c,d",e
a;b;c,d;e


I see that was an uneducated comment on my part ;-)
(I have been doing alot of *simple* csv parsing with glib lately
that doesnt have these kind of requirements).

Sorry for the noise ;-)

Dont have much of an opinion if it should be in glib, we have
GKeyFile wich does similar high-levelish stuff already so it
might be a suitable addition.

Cheers,
      -Tristan

(interestingly my own use-case, would be a mix of both - a
fixed length keyfile like header, with variable length trailing
csv data).


You also have to deal with differing line ending conventions.

It's enough of a mess that both MS Office and most other
office programs today seem o use XML instead :-)

Probably gnumeric has code for this, though.

Liam


--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]