Thanks Leonel.

Here is my form:
    form = SQLFORM.factory(
        Field('table',requires=IS_IN_SET(db.tables)),
        Field('csvfile','upload',uploadfield=False))
    form.process()
    if form.accepted:
        table = form.vars.table
        csvtxt = request.vars.csvfile.file.read()
        #Replacing decimal point ',' by '.'
        csvtxt = cvstxt.replace(',','.')

A csv file sample:
id_crm;code;description;price_list;special_offer
407;04050100851;DRFRR1;59.61;FALSO
408;04050100852;DRFRR2;59.61;VERO


----------------------
Gael Princivalle

2014-10-03 22:29 GMT+02:00 Leonel Câmara <[email protected]>:

> No, what I mean is, can I see the form you use to upload. And can you show
> me more of that controller and/or more of the ticket error. The error
> you're getting "global name 'cvsfile' is not defined" doesn't make sense to
> me.
>
> An alternative is to read the excel directly using xlrd (
> http://www.python-excel.org/ ) however we should be able to make this
> work.
>
> You can also provide a sample csv and your define table that's importing
> it and I might try to understand what's going on Sunday or so.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/rDIOmGTxSRs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to