Skip to content

Commit

Permalink
resolve #11 use write only flag to run optimized writing
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Aug 25, 2016
1 parent 8267036 commit 8391195
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions pyexcel_xlsx/xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,7 @@ def write_row(self, array):
"""
write a row into the file
"""
for i in range(0, len(array)):
cell_location = "%s%d" % (get_columns(i), self.current_row)
self.native_sheet.cell(cell_location).value = array[i]
self.current_row += 1
self.native_sheet.append(array)


class XLSXWriter(BookWriter):
Expand All @@ -151,16 +148,11 @@ def __init__(self):

def open(self, file_name, **keywords):
BookWriter.open(self, file_name, **keywords)
self.native_book = openpyxl.Workbook()
self.native_book = openpyxl.Workbook(write_only=True)

def create_sheet(self, name):
if self.current_sheet == 0:
self.current_sheet = 1
return XLSXSheetWriter(self.native_book,
self.native_book.active, name)
else:
return XLSXSheetWriter(self.native_book,
self.native_book.create_sheet(), name)
return XLSXSheetWriter(self.native_book,
self.native_book.create_sheet(), name)

def close(self):
"""
Expand Down

0 comments on commit 8391195

Please sign in to comment.