Python study notes 14_Operating Excel

Operate Excel

1. Install xlrd, xlwt third-party modules

2. Write Excel

import xlwt
book = xlwt.Workbook()#Create a new excel
sheet = book.add_sheet('student information')#Add sheet page
sheet.write(0,0,'name')#row, column, written content
sheet.write(0,1,'age' )
sheet.write(0,2,'sex' )
book.save('stu.xls')# must end with .xls

3. Read Excel

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325277873&siteId=291194637