The project I will be working on requires all users to import from 
spreadsheets, so thats not really possible.

On Wednesday, June 20, 2012 9:49:57 AM UTC-5, Richard wrote:
>
> Why don't use the appadmin export and import ?
>
> Richard
>
> On Wed, Jun 20, 2012 at 9:55 AM, joe  wrote:
>
>> I want to import from a csv file, but I want to use the imported data in 
>> only one of my database tables, not all of them, which is how I have seen 
>> the examples online.  Here is my code, which does not work:
>>
>> Model
>> -------------------
>> db.define_table(
>>     'upload', 
>>     Field('name'),
>>     Field('email'))
>>
>> db.upload.name.requires = IS_NOT_EMPTY()
>> db.upload.email.requires = [IS_EMAIL, IS_NOT_IN_DB(db, 'upload.email')]
>>
>> Controller
>> ----------------------
>> def upload():
>>     db.upload.import_from_csv_file('nameTest.csv')
>>     records = 
>> SQLTABLE(db().select(db.upload.ALL),headers='fieldname:capitalize')
>>     return dict(records=records)
>>
>>
>> View
>> ------------------
>> {{extend 'layout.html'}}
>>
>>
>> <h2>Current data</h2>
>> {{=records}}
>>
>>
>>
>>
>> I know its basic, but I am just working on getting the feel for things 
>> before I do a bigger project.
>>
>
>

Reply via email to