Skip to content

Instantly share code, notes, and snippets.

@luiscberrocal
Created October 14, 2018 12:43
Show Gist options
  • Save luiscberrocal/32708c5200fbc638a055f636c48335cc to your computer and use it in GitHub Desktop.
Save luiscberrocal/32708c5200fbc638a055f636c48335cc to your computer and use it in GitHub Desktop.
Simple example on how to write to excel
wb = Workbook()
sheet = wb.create_sheet()
row = 1
col = 1
for header in headers:
sheet.cell(row=row, column=col, value=header)
col += 1
row += 1
git_lines = self.report(git_format)
for line in git_lines:
self.stdout.write(line)
line_data = line.split('|')
col = 1
for data in line_data:
sheet.cell(row=row, column=col, value=data)
col += 1
row += 1
wb.save(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment