Re: how to import excel file into django models?
I have used two methods -- one works only on Windows, the other is cross platform -- and you have said nothing about your application so it is hard to advise...
If you know Windows and SQL -- then use adobapi and open the spreadsheet as a table (see examples at http://sourceforge.net/projects/adodbapi) and read it using SQL SELECT commands.
If you are on Linux, then xlrd is your friend. (Find it on pypi or http://www.python-excel.org/) In my case, the spreadsheet was large, and the columns moved around from time to time, so I wrote a mini-ORM (xlrd_helper) to allow me to refer to the spreadsheet columns by name, rather than by number, and handle the idiosyncrasies of my application. I have been working on this for several months, but my work is too application specific to publish. (You probably do not need to do automatic spelling correction for the names of Nigerian villages.) The python code which does the import is implemented as a set of manage.py command scripts.
--
Vernon Cole
On Saturday, June 1, 2013 3:21:33 AM UTC-6, Ali hallaji wrote:
On Saturday, June 1, 2013 3:21:33 AM UTC-6, Ali hallaji wrote:
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home