Last active
December 29, 2020 00:47
-
-
Save Taichi-Pink/a4d13b52a285fb4328502bf81f1a9fd4 to your computer and use it in GitHub Desktop.
Create your first excel file by Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xlwt | |
from xlwt import Workbook | |
# Workbook is created | |
wb = Workbook() | |
# add_sheet is used to create sheet. | |
sheet1 = wb.add_sheet('first sheet') | |
#sheet1.write(row, colum, content) | |
sheet1.write(0, 1, 'Title') | |
sheet1.write(0, 2, 'Name') | |
sheet1.write(0, 3, 'Sex') | |
sheet1.write(0, 4, 'Age') | |
sheet1.write(0, 5, 'Email') | |
sheet1.write(1, 0, 'Tom') | |
sheet1.write(2, 0, 'Alice') | |
sheet1.write(3, 0, 'Jerry') | |
sheet1.write(4, 0, 'Honey') | |
sheet1.write(5, 0, 'Monica') | |
wb.save('xlwt.xls') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment