Hello,
I have tried recently to create & import data from a CSV file. I had
to abort because web2py gave the message: unabel to parse file (this
coule be a bit more verbose...)

Here are my steps:

1) the table I would like to import:
http://www.ncdc.noaa.gov/oa/climate/rcsg/cdrom/ismcs/alphanum.html
2) using text editor and spreadsheets I created a CSV file.
3) entering table definition in db.py:

[CODE]
db.define_table('wmostations',
                SQLField('stn_number', 'integer', label='Station
Number'),
                SQLField('stn_id', 'string', label='Station ID'),
                SQLField('stn_xname', 'string', label='Station Name'),
                SQLField('ctry', 'string', label='Country'),
                SQLField('lat', 'string', label='Latitude'),
                SQLField('long', 'string', label='Longitude'),
                SQLField('el_ft', 'integer', label='Elevation
(Feet)'),
                SQLField('el_m', 'integer', label='Elevation
(Meter)'),
                SQLField('type', 'string',
label='Type'),
                )
[/CODE]

4) going to admin and export the empty table to CSV.
the header goes like:
wmostations.id,wmostations.stn_number,
wmostations.stn_id,wmostations.stn_xname,
wmostations.ctry,wmostations.lat,wmostations.long,
wmostations.el_ft,wmostations.el_m,
wmostations.type

5) then add the data to this template CSV file in the spreadsheet
application:
The first line looks like:
" 01 0100","ENAN"," ANDOYA/ANDENES(AFB)     ","NO","69 18N","016 09E",
46,14," USNT",

6) loading this into web2py via the db admin

=> web2py shows a flash message that it couldn't parse the file.

My questions:
* Do I need to fill something in the first column: wmostations.id?
* Why does web2py not parse the file?
* Is it possible to wrap text with " some text, with comma"?

My proposal/feature request:
* Could the import tool be expanded to add support for more dialiects
(e.g. other delimiters)?
* Could the be an option to create table definitions by parsing a CSV
file and guessing the field types from the data?
    More even analyse excel files...

Thanks in advance for your assistance and suggestions,
Timmie
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to