@@ -32,7 +32,7 @@ The parameter **file** is coded in the html form::
3232
3333.. warning::
3434 If 'field_name' was not specified, for example `request.get_array('file')`
35- in upload_file() function, your browser would display "Bad Request: The
35+ in upload_file() function, your browser would display "Bad Request: The
3636 browser (or proxy) sent a request that this server could not understand."
3737
3838The latter simply throws back a csv file whenever a http request is made to
@@ -45,7 +45,7 @@ http response. If you would like to give 'tsvz' a go, please change "csv" to
4545
4646More excel file formats
4747--------------------------------------------------------------------------------
48-
48+
4949The example application understands csv, tsv and its zipped variants: csvz and
5050tsvz. If you would like to expand the list of supported excel file formats
5151(see :ref:`file-format-list`) for your own application, you could include one
@@ -75,7 +75,7 @@ Now let's add the following imports first::
7575
7676Now configure the database connection. Sqllite will be used and **tmp.db** will
7777be used and can be found in your current working directory::
78-
78+
7979 app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///tmp.db'
8080 db = SQLAlchemy(app)
8181
@@ -124,19 +124,23 @@ Then visit http://localhost:5000/custom_export to download the data
124124{%endblock%}
125125
126126{%block api_table%}
127- =========================== ======================================================= ==================================================
128- data structure from file to data structures from data structures to response
129- =========================== ======================================================= ==================================================
130- dict :meth:`~flask_excel.ExcelRequest.get_dict` :meth:`~flask_excel.make_response_from_dict`
131- records :meth:`~flask_excel.ExcelRequest.get_records` :meth:`~flask_excel.make_response_from_records`
132- a list of lists :meth:`~flask_excel.ExcelRequest.get_array` :meth:`~flask_excel.make_response_from_array`
133- dict of a list of lists :meth:`~flask_excel.ExcelRequest.get_book_dict` :meth:`~flask_excel.make_response_from_book_dict`
134- :class:`pyexcel.Sheet` :meth:`~flask_excel.ExcelRequest.get_sheet` :meth:`~flask_excel.make_response`
135- :class:`pyexcel.Book` :meth:`~flask_excel.ExcelRequest.get_book` :meth:`~flask_excel.make_response`
136- database table :meth:`~flask_excel.ExcelRequest.save_to_database` :meth:`~flask_excel.make_response_from_a_table`
137- a list of database tables :meth:`~flask_excel.ExcelRequest.save_book_to_database` :meth:`~flask_excel.make_response_from_tables`
138- a database query sets :meth:`~flask_excel.make_response_from_query_sets`
139- =========================== ======================================================= ==================================================
127+ =========================== ======================================================== ==================================================
128+ data structure from file to data structures from data structures to response
129+ =========================== ======================================================== ==================================================
130+ dict :meth:`~flask_excel.ExcelRequest.get_dict` :meth:`~flask_excel.make_response_from_dict`
131+ records :meth:`~flask_excel.ExcelRequest.get_records` :meth:`~flask_excel.make_response_from_records`
132+ a list of lists :meth:`~flask_excel.ExcelRequest.get_array` :meth:`~flask_excel.make_response_from_array`
133+ dict of a list of lists :meth:`~flask_excel.ExcelRequest.get_book_dict` :meth:`~flask_excel.make_response_from_book_dict`
134+ :class:`pyexcel.Sheet` :meth:`~flask_excel.ExcelRequest.get_sheet` :meth:`~flask_excel.make_response`
135+ :class:`pyexcel.Book` :meth:`~flask_excel.ExcelRequest.get_book` :meth:`~flask_excel.make_response`
136+ database table :meth:`~flask_excel.ExcelRequest.save_to_database` :meth:`~flask_excel.make_response_from_a_table`
137+ :meth:`~flask_excel.ExcelRequest.isave_to_database`
138+ a list of database tables :meth:`~flask_excel.ExcelRequest.save_book_to_database` :meth:`~flask_excel.make_response_from_tables`
139+ :meth:`~flask_excel.ExcelRequest.isave_book_to_database`
140+ a database query sets :meth:`~flask_excel.make_response_from_query_sets`
141+ a generator for records :meth:`~django_excel.ExcelMixin.iget_records`
142+ a generator of lists :meth:`~django_excel.ExcelMixin.iget_array`
143+ =========================== ======================================================== ==================================================
140144{%endblock%}
141145
142146{%block api_doc %}
@@ -157,7 +161,7 @@ ExcelRequest
157161 :returns: A sheet object
158162
159163 The following html form, the *field_name* should be "file"::
160-
164+
161165 <!doctype html>
162166 <title>Upload an excel file</title>
163167 <h1>Excel file upload (csv, tsv, csvz, tsvz only)</h1>
@@ -203,12 +207,19 @@ ExcelRequest
203207.. method:: save_to_database(field_name=None, session=None, table=None, initializer=None, mapdict=None **keywords)
204208
205209 :param field_name: same as :meth:`~flask_excel.ExcelRequest.get_sheet`
206- :param session: a SQLAlchemy session
207- :param table: a database table
210+ :param session: a SQLAlchemy session
211+ :param table: a database table
208212 :param initializer: a custom table initialization function if you have one
209213 :param mapdict: the explicit table column names if your excel data do not have the exact column names
210214 :param keywords: additional keywords to :meth:`pyexcel.Sheet.save_to_database`
211215
216+ .. method:: isave_to_database(field_name=None, session=None, table=None, initializer=None, mapdict=None **keywords)
217+
218+ similar to :meth:`:meth:`~flask_excel.ExcelRequest.isave_to_database`. But it requires
219+ less memory.
220+
221+ This requires column names must be at the first row.
222+
212223.. method:: save_book_to_database(field_name=None, session=None, tables=None, initializers=None, mapdicts=None, **keywords)
213224
214225 :param field_name: same as :meth:`~flask_excel.ExcelRequest.get_sheet`
@@ -218,6 +229,12 @@ ExcelRequest
218229 :param mapdicts: a list of explicit table column names if your excel data sheets do not have the exact column names
219230 :param keywords: additional keywords to :meth:`pyexcel.Book.save_to_database`
220231
232+ .. method:: isave_book_to_database(field_name=None, session=None, tables=None, initializers=None, mapdicts=None, **keywords)
233+
234+ similar to :meth:`:meth:`~flask_excel.ExcelRequest.isave_book_to_database`. But it requires
235+ less memory.
236+
237+ This requires column names must be at the first row in each sheets
221238
222239Response methods
223240**********************
@@ -228,7 +245,7 @@ Response methods
228245
229246 :param pyexcel_instance: :class:`pyexcel.Sheet` or :class:`pyexcel.Book`
230247 :param file_type: one of the following strings:
231-
248+
232249 * 'csv'
233250 * 'tsv'
234251 * 'csvz'
@@ -237,7 +254,7 @@ Response methods
237254 * 'xlsx'
238255 * 'xlsm'
239256 * 'ods'
240-
257+
241258 :param status: unless a different status is to be returned.
242259 :param file_name: provide a custom file name for the response, excluding the file extension
243260
@@ -294,7 +311,7 @@ Response methods
294311 Produce a multiple sheet Excel book of *file_type*. It becomes the same
295312 as :meth:`~flask_excel.make_response_from_a_table` if you pass *tables*
296313 with an array that has a single table
297-
314+
298315 :param session: SQLAlchemy session
299316 :param tables: SQLAlchemy tables
300317 :param file_type: same as :meth:`~flask_excel.make_response`
0 commit comments