@@ -101,6 +101,10 @@ A minimal application may look like this::
101101 def download_file():
102102 return excel.make_response_from_array([[1,2], [3, 4]], "csv")
103103
104+ @app.route("/export", methods=['GET'])
105+ def export_records():
106+ return excel.make_response_from_array([[1,2], [3, 4]], "csv", file_name="export_data")
107+
104108 # insert database related code here
105109
106110 if __name__ == "__main__":
@@ -351,51 +355,57 @@ Response methods
351355 * 'ods'
352356
353357 :param status: unless a different status is to be returned.
354-
355- .. method :: make_response_from_array(array, file_type, status=200)
358+ :param file_name: provide a custom file name for the response, excluding the file extension
359+
360+ .. method :: make_response_from_array(array, file_type, status=200, file_name=None)
356361
357362 :param array: a list of lists
358363 :param file_type: same as :meth: `~flask_excel.make_response `
359364 :param status: same as :meth: `~flask_excel.make_response `
360-
361- .. method :: make_response_from_dict(dict, file_type, status=200)
365+ :param file_name: same as :meth: `~flask_excel.make_response `
366+
367+ .. method :: make_response_from_dict(dict, file_type, status=200, file_name=None)
362368
363369 :param dict: a dictinary of lists
364370 :param file_type: same as :meth: `~flask_excel.make_response `
365371 :param status: same as :meth: `~flask_excel.make_response `
366-
367- .. method :: make_response_from_records(records, file_type, status=200)
372+ :param file_name: same as :meth: `~flask_excel.make_response `
373+
374+ .. method :: make_response_from_records(records, file_type, status=200, file_name=None)
368375
369376 :param records: a list of dictionaries
370377 :param file_type: same as :meth: `~flask_excel.make_response `
371378 :param status: same as :meth: `~flask_excel.make_response `
372-
373-
374- .. method :: make_response_from_book_dict(book_dict, file_type, status=200)
379+ :param file_name: same as :meth: ` ~flask_excel.make_response `
380+
381+ .. method :: make_response_from_book_dict(book_dict, file_type, status=200, file_name=None )
375382
376383 :param book_dict: a dictionary of two dimensional arrays
377384 :param file_type: same as :meth: `~flask_excel.make_response `
378385 :param status: same as :meth: `~flask_excel.make_response `
386+ :param file_name: same as :meth: `~flask_excel.make_response `
379387
380- .. method :: make_response_from_a_table(session, table, file_type status=200)
388+ .. method :: make_response_from_a_table(session, table, file_type status=200, file_name=None )
381389
382390 Produce a single sheet Excel book of *file_type *
383391
384392 :param session: SQLAlchemy session
385393 :param table: a SQLAlchemy table
386394 :param file_type: same as :meth: `~flask_excel.make_response `
387395 :param status: same as :meth: `~flask_excel.make_response `
396+ :param file_name: same as :meth: `~flask_excel.make_response `
388397
389- .. method :: make_response_from_query_sets(query_sets, column_names, file_type status=200)
398+ .. method :: make_response_from_query_sets(query_sets, column_names, file_type status=200, file_name=None )
390399
391400 Produce a single sheet Excel book of *file_type * from your custom database queries
392401
393402 :param query_sets: a query set
394403 :param column_names: a nominated column names. It could not be None, otherwise no data is returned.
395404 :param file_type: same as :meth: `~flask_excel.make_response `
396405 :param status: same as :meth: `~flask_excel.make_response `
406+ :param file_name: same as :meth: `~flask_excel.make_response `
397407
398- .. method :: make_response_from_tables(session, tables, file_type status=200)
408+ .. method :: make_response_from_tables(session, tables, file_type status=200, file_name=None )
399409
400410 Produce a multiple sheet Excel book of *file_type *. It becomes the same
401411 as :meth: `~flask_excel.make_response_from_a_table ` if you pass *tables *
@@ -405,8 +415,9 @@ Response methods
405415 :param tables: SQLAlchemy tables
406416 :param file_type: same as :meth: `~flask_excel.make_response `
407417 :param status: same as :meth: `~flask_excel.make_response `
418+ :param file_name: same as :meth: `~flask_excel.make_response `
419+
408420
409-
410421Indices and tables
411422--------------------
412423
0 commit comments