Bootstrap

python如何读取excel表中的一个cell_在pythonxlrd/x中,从excel单元格读取并写入另一个excel工作表... 原创

我正在使用python中的xlrd、xlwt和xlutils库从excel表读写。因此,我已经成功地读写了excel表。在

但是,我需要一些关于捕获我正在从中读取的单元格的格式以及将相同的格式应用于正在写入的单元格的说明。在

以下是我尝试过的-#Open excel sheet & read from tab1

rb = open_workbook(r'C:\Users\abc\excel.xls', formatting_info=True)

sheet = rb.sheet_by_name("tab1")

#Search the excel sheet for the string and return location of Cell

def searchStringCell(searchString):

for i in range(sheet.nrows):

row = sheet.row_values(i)

for j in range(len(row)):

if row[j] == searchString:

return i,j

# Search string to be read

header='

'

headerTitleX,headerTitleY=searchStringCell(header)

cell = sheet.cell(headerTitleX, headerTitleY)

print "Title Cell : (",headerTitleX,",",headerTitleY,")"

#Write data to cell which is 2 columns

;