Skip to content

Commit ceb93c3

Browse files
committed
fix #27: use rownames to detect SheetStream
1 parent ab86642 commit ceb93c3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pyexcel_text/_json.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def render_book(self, book):
2929
def jsonify(sheet, file_type, write_title):
3030
content = ""
3131
table = sheet.to_array()
32-
if isinstance(table, types.GeneratorType):
33-
table = list(table)
34-
else:
32+
if hasattr(sheet, 'rownames'):
3533
colnames = sheet.colnames
3634
rownames = sheet.rownames
3735
# In the following, row[0] is the name of each row
@@ -42,6 +40,8 @@ def jsonify(sheet, file_type, write_title):
4240
table = [dict(zip(colnames, row)) for row in table[1:]]
4341
elif rownames:
4442
table = dict((row[0], row[1:]) for row in table)
43+
else:
44+
table = list(table)
4545
if write_title:
4646
content = {sheet.name: table}
4747
else:

0 commit comments

Comments
 (0)