You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**django-excel** is based on `pyexcel <https://github.com/chfw/pyexcel>`_ and makes it easy to consume/produce information stored in excel files over HTTP protocol as well as on file system. This library can turn the excel data into Pythonic a list of lists, a list of records(dictionaries), dictionaries of lists. And vice versa. Hence it lets you focus on data in Flask based web development, instead of file formats.
10
17
11
18
The highlighted features are:
@@ -35,7 +42,27 @@ The highlighted features are:
35
42
.. _ods3: https://github.com/chfw/pyexcel-ods3
36
43
.. _text: https://github.com/chfw/pyexcel-text
37
44
38
-
This library make infomation processing involving various excel files as easy as processing array, dictionary when processing file upload/download, data import into and export from SQL databases, information analysis and persistence. It uses **pyexcel** and its plugins: 1) to provide one uniform programming interface to handle csv, tsv, xls, xlsx, xlsm and ods formats. 2) to provide one-stop utility to import the data in uploaded file into a database and to export tables in a database as excel files for file download 3) to provide the same interface for information persistence at server side: saving a uploaded excel file to and loading a saved excel file from file system.
45
+
This library makes infomation processing involving various excel files as easy as processing array, dictionary when processing file upload/download, data import into and export from SQL databases, information analysis and persistence. It uses **pyexcel** and its plugins: 1) to provide one uniform programming interface to handle csv, tsv, xls, xlsx, xlsm and ods formats. 2) to provide one-stop utility to import the data in uploaded file into a database and to export tables in a database as excel files for file download 3) to provide the same interface for information persistence at server side: saving a uploaded excel file to and loading a saved excel file from file system.
The test application is written according to Step 1, Step 2 and Step3 of django tutorial version 1.7.1. If you should wonder how the test application was written, please visit django documentation and come back.
74
+
The test application is written according to `Part 1 <https://docs.djangoproject.com/en/1.7/intro/tutorial01/>`_, `Part 2 <https://docs.djangoproject.com/en/1.7/intro/tutorial02/>`_ and `Part 3 <https://docs.djangoproject.com/en/1.7/intro/tutorial03/>`_ of django tutorial version 1.7.1. If you should wonder how the test application was written, please visit django documentation and come back.
48
75
49
76
Once you have the code, please change to django-excel directory and then install all dependencies::
50
77
@@ -75,7 +102,7 @@ Choose an excel sheet, for example an xls file, and press "Submit". You will get
75
102
76
103
.. image :: download-file.png
77
104
78
-
Please open the file **polls/views.py** and focus on the following code section::
105
+
Please open the file `polls/views.py<https://github.com/chfw/django-excel/blob/master/polls/views.py#L27>`_ and focus on the following code section::
79
106
80
107
class UploadFileForm(forms.Form):
81
108
file = forms.FileField()
@@ -100,7 +127,7 @@ Please feel free to change those functions according to :ref:`the mapping table
100
127
Handle data import
101
128
++++++++++++++++++++++++++++++
102
129
103
-
This example shows how to import uploaded excel file into django models. We are going to import *sample-data.xls*
130
+
This example shows how to import uploaded excel file into django models. We are going to import `sample-data.xls<https://github.com/chfw/django-excel/blob/master/sample-data.xls>`_
104
131
105
132
.. table:: Sheet 1 of sample-data.xls
106
133
@@ -145,7 +172,7 @@ Please visit this link http://localhost:8000/import/, you shall see this upload
145
172
146
173
.. image:: import-page.png
147
174
148
-
Please then select *sample-data.xls* and upload. Then visit the admin page http://localhost:8000/admin/polls/question, you shall see questions have been populated:
175
+
Please then select `sample-data.xls<https://github.com/chfw/django-excel/blob/master/sample-data.xls>`_ and upload. Then visit the admin page http://localhost:8000/admin/polls/question, you shall see questions have been populated:
149
176
150
177
.. image:: question-admin.png
151
178
@@ -158,7 +185,7 @@ And choices too:
158
185
159
186
You may use admin interface to delete all those objects and try again.
160
187
161
-
Now please open views.py and focus on this part of code::
188
+
Now please open `polls/views.py<https://github.com/chfw/django-excel/blob/master/polls/views.py#L54>`_ and focus on this part of code::
162
189
163
190
def import_data(request):
164
191
if request.method == "POST":
@@ -213,7 +240,7 @@ Please save and open it. You shall see these data in your window:
213
240
.. image:: question-sheet.png
214
241
.. image:: choice-sheet.png
215
242
216
-
Now let's examine the code behind this::
243
+
Now let's examine the code behind this in `polls/views.py <https://github.com/chfw/django-excel/blob/master/polls/views.py#L48>`_::
0 commit comments