There is no better way to write excel,lorinnn search on the Internet and later use of the method is to use a third-party library xlutils to achieve this function, the main idea is to first copy the sheet and then again on the basis of appending and saving to a new Excel document.
Using Xlutils
The code is implemented as follows:
#-*-Coding:utf-8-*-"Created on 2012-12-17 @author: walfred @module: xlrdpkg.write_append @description: '
import OS from xlutils.copy import copy import xlrd as Excelread def write_append (file_name): values = ["Ann", "W Oman ",", "UK"] R_xls = Excelread.open_workbook (file_name) r_sheet = R_xls.sheet_by_index (0) rows = R_ Sheet.nrows w_xls = Copy (r_xls) sheet_write = W_xls.get_sheet (0) for I in range (0, Len (values)): Sheet_write.write (rows, I, values[i]) w_xls.save (file_name + '. Out ' + os.path.splitext (file_name) [-1]); if __name__ = = "__main__": write_append ("./test_append.xls")
Before the Chase
Name Sex age countryjim Mans usahmm woman Chnlilei Man
After the pursuit of writing
Name sex age countryjim Mans usahmm woman chnlilei man Chnann woman