简体   繁体   中英

getting a row using xlwt

Anyone know how to reference a given row of newSheet shown below

import xlwt
outFile = xlwt.Workbook()
newSheet = outFile.add_sheet('Sheet 1', cell_overwrite_ok=True)
#Write a bunch of data to newSheet

For example I want to reference the first row so I can find which column has a certain header.

EDIT: I'd like to be to run this code somehow

newSheet.col(firstRow.index('some pattern')).width = 3000

xlwt is only for writing Excel files. Use xlrd for reading. If you have written the file yourself should know what you wrote where. Just remember in a dict or list where you wrote your header.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM