Yes, I've done that. The following function read_excel_csv works with
Excel CSV files saved on Mac (I can't remember exactly, but it might
be that MS Office for Mac OS X saves CSV files using different
separators than on Windows). The function reads the rows line by line,
parses the cells of each row and passes the values in a list to your
custom function.

###################
import csv

def test(l):
    print l

def read_excel_csv(filepath, function):
    f = open(filepath, "rb")
    line_list = "".join(f.readlines()).split("\r")
    reader = csv.reader(line_list, delimiter=";", doublequote=True)
    for value_list in reader:
        function(value_list)

>>> read_excel_csv("/some/path/table.csv", test)
###################

Good luck!
Aidas Bendoraitis aka Archatas


On 8/21/07, olivier <[EMAIL PROTECTED]> wrote:
>
> > Have any of you guys imported excel/cvs by using Python/Django? I need
> > to import 1000 products for a shopping site and I'd like to learn the
> > fastest and easiest way to do so.
>
>
> If you need to load data straight from the Excel, you can use xlrd,
> which works great.
>
> http://www.lexicon.net/sjmachin/xlrd.htm
>
> Regards,
>
>     Olivier
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to