Skip to content

Commit f32dd27

Browse files
committed
pyexcel-webwares/Flask-Excel#19, sheet_name for name a pyexcel.Sheet instance, not for pyexcel.Book
1 parent c101f25 commit f32dd27

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyexcel_webio/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ def _make_response(content, file_type,
231231

232232

233233
def make_response(pyexcel_instance, file_type,
234-
status=200, file_name=None, **keywords):
234+
status=200, file_name=None,
235+
sheet_name=None, **keywords):
235236
"""
236237
Make a http response from a pyexcel instance of
237238
:class:`~pyexcel.Sheet` or :class:`~pyexcel.Book`
@@ -251,6 +252,8 @@ def make_response(pyexcel_instance, file_type,
251252
:param status: unless a different status is to be returned.
252253
:returns: http response
253254
"""
255+
if hasattr(pyexcel_instance, 'name') and sheet_name is not None:
256+
pyexcel_instance.name = sheet_name
254257
file_content = pyexcel_instance.save_to_memory(file_type, None, **keywords)
255258
return _make_response(file_content, file_type, status, file_name)
256259

0 commit comments

Comments
 (0)