Manipulate excel - modify

## xlutils

import xlrd

from xlutils import copy #xlutils module must be imported into a single module for use

book = xlrd.open_workbook('app_student.xls') #First
use the xlrd module to open an excel

new_book = copy.copy(book)
#Copy a copy of excel through the copy method in the xlutils module


sheet = new_book.get_sheet(0) #Get sheet page

lis = ['number','name','sex','age','address','class','mobile phone number','gold coin']

for col,filed in enumerate(lis):
  sheet.write(0,col,filed)

new_book.save('app_student.xls')

Guess you like

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