[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Import excel file
From: |
John Darrington |
Subject: |
Re: Import excel file |
Date: |
Tue, 12 Apr 2011 18:09:39 +0000 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Tue, Apr 12, 2011 at 02:31:14AM -0300, Michel Boaventura wrote:
Hello,
Talking with Ben I decide to try to make an excel data import to pspp.
I've found libxls (http://libxls.sourceforge.net/) an LGPL3
library to help read this kind of file.
I was able to make a small program that open an excel file and returns
it as a csv. It would be very nice if you could help me to
improve/plug it into
pspp. Where do I start?
Importing XLS files would certainly be a good thing to have. It sounds
like you already have a working proof of concept.
Where to start? src/language/data-io/get-data.c contains the parser
for the GET DATA command. Currently we have the code:
if (lex_match_id (lexer, "GNM"))
return parse_get_gnm (lexer, ds);
else if (lex_match_id (lexer, "TXT"))
return parse_get_txt (lexer, ds);
else if (lex_match_id (lexer, "PSQL"))
return parse_get_psql (lexer, ds);
So you'll have to add a "XLS" to that. The options for importing an
excel spreadsheet are likely to be similar (if not identical) to those
for gnumeric. So parse_get_gnm could probably be renamed to
parse_get_spreadsheet (and suffer a few very small modifications).
Then, you will need to implement the code to read the stuff in. This
would entail taking your program and turning it into an implementation
of a casereader which grabs rows from the excel file. Like this:
struct casereader * excel_open_reader (struct excel_read_opts *, struct
dictionary **);
The code in src/data/gnumeric-reader.c can probably be used as a template.
Again, much
of the code might well be identical to what you need.
So. Get the syntax :
GET DATA /TYPE=XLS /FILE= ....
all working and take it from there.
Post a message here, or shout on #pspp if you need help.
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature
- Import excel file, Michel Boaventura, 2011/04/12
- Re: Import excel file,
John Darrington <=
- Re: Import excel file, Michel Boaventura, 2011/04/13
- Re: Import excel file, Michel Boaventura, 2011/04/13
- Re: Import excel file, John Darrington, 2011/04/13
- Re: Import excel file, Michel Boaventura, 2011/04/13
- Re: Import excel file, Michel Boaventura, 2011/04/13
- Re: Import excel file, John Darrington, 2011/04/13
- Re: Import excel file, Michel Boaventura, 2011/04/13
- Re: Import excel file, Ben Pfaff, 2011/04/14
- Re: Import excel file, John Darrington, 2011/04/14
- Re: Import excel file, Ben Pfaff, 2011/04/14