通过django管理员将excel数据导入模型 [英] Import excel data into models via django admin
问题描述
我需要Django管理界面接受Excel文件的管理员上传,其中每个Excel文件中的数据都插入到我的数据库模型中。如何在Django模型管理页面上显示这样一个上传按钮,点击该按钮可让管理员选择一个 .xls
文件,然后将其数据添加到到数据库一旦上传完成,
I need the Django Admin interface to accept administrator uploads of Excel files where the data in each Excel file is inserted into my database models. How can I make such an "Upload" button appear on a Django model admin page, where clicking the button asks the administrator to choose an .xls
file, whose data then gets added to database once its upload is complete?
推荐答案
我不知道Django方面的事情,但你可以使用<阅读和操作Excel文件的href =http://pypi.python.org/pypi/xlrd =nofollow> xlrd 。有一个免费的PDF解释这个称为使用Python中的Excel文件
I'm not sure about the Django side of things, but you can use xlrd to read and manipulate Excel files. There is a free PDF which explains this called Working with Excel files in Python
这篇关于通过django管理员将excel数据导入模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!